views:

186

answers:

2

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!

A: 

Have you looked at the YUI JSON utility?

Cal Jacobson
+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