I downloaded the code from json.org to serialize/deserialize javascript objects to/from json and it worked just fine. However, in production, it conflicts with my other javascript code apparently because it uses for in loops. Is there another library that does this? Thanks!
views:
186answers:
2
+2
A:
I use jQuery, specifically with the jQuery-JSON plugin. As you can see from the link, this works like so
var thing = {plugin: 'jquery-json', version: 1.3};
var encoded = $.toJSON(thing); //'{"plugin": "jquery-json", "version": 1.3}'
var name = $.evalJSON(encoded).plugin; //"jquery-json"
var version = $.evalJSON(encoded).version; // 1.3
Eli Courtwright
2009-06-30 17:32:04