A problem I was facing recently, that the JSON was being receive properly on Firefox 3.6 my work development machine. Finished the project and deployed it. I haven’t tested it on other machines, how clever am I?! I opened my laptop to see how it would appear on other browsers, and shockingly, it wasn’t working at all!
After spending hours trying to locate the line where the error occurs and find out what’s the problem it turned out that I have to decode the JSON output before sending it. I wasn’t using any PHP built-in functionality for JSON, that’s because at work, we are still using PHP4 which has none. I was basically writing the JSON output explicitly. The text output can contain some special characters that need to be encoded and escaped before sending it. After digging around a bit I found out a solution from this post. Everything is pretty much explained there.