jQuery parsererror: clean up your JSON objects

Has your JSON using jQuery web app suddenly stopped working?  Getting a parsererror on your JSON objects, where you got none before?  This is what happened to me when my site upgraded to jQuery 1.4.

I use the Google API’s jQuery, and it automatically upgraded my whole site to jQuery 1.4.   In jQuery 1.4, they decided to tighten up the JSON parsing engine, so that it is now unforgiving of any lax standards.  You have to follow the JSON standard spelled out here — to the letter.  In my case, that meant changing any single quoted values or names to double quotes, and getting rid of opening and closing parentheses.  Like most fixes, it was an easy fix, once I figured it out.  Hope this helps.

-Colin

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.