I need to store some data on the server in form of key,value pairs which will be transmitted to the frontend and converted to javascript arrays for further processing. I chose the JSON format and built a small json db. For some reason I was using ‘jquery 1.3.2’ for testing and when I shifted to ‘jquery 1.6.2’, my code stopped working and I figured out that thats because of invalid JSON which jquery (1.4+) silently ignores.
As of jQuery 1.4, if the JSON file contains a syntax error, the
request will usually fail silently. Avoid frequent hand-editing of
JSON data for this reason. JSON is a data-interchange format with
syntax rules that are stricter than those of JavaScript’s object
literal notation.
So whats a good, low bandwidth alternative for json which is easy to parse with Jquery, which can be easily hand-edited and is not so strict about syntax? (Not that I intend to make syntax errors, but in case there’s one, don’t want everything to stop working)
Alternatively, is there a way to force jquery to parse invalid JSON?
One of the jQuery core team members posted this workaround to get pre-1.4 functionality for JSON:
http://yehudakatz.com/2010/01/15/jquery-1-4-and-malformed-json/
Is this along the lines of what you’re looking for?