You need to realize that as soon as you change the code that's in the book, it's nearly impossible for us to know what a generic error message such as this means. The example in the book works perfectly, so the error must be in the changes you made.
That being said, the most likely culprit is that the code you added/changed is not producing valid JSON code. The JSON parser will throw an error whenever an unexpected piece of syntax is encountered. Double check your JSON output and you'll probably find the error.
Nicholas C. Zakas