You can user browser native function JSON.stringify to do this

var foo = {};
foo.bar = "new property";
foo.baz = 3;

var jsonString = JSON.stringify(foo);

https://developer.mozilla.org/En/Using_JSON_in_Firefox

And IE8 also supports it - http://blogs.msdn.com/b/ie/archive/2008/09/10/native-json-in-ie8.aspx