Modern browsers (IE8, FF3, Chrome etc.) have native JSON support built in (Same API as with JSON2).
So as long you‘re not dealing with IE6/7 you can do it just as easily as that:
var j={"name":"binchen"};
JSON.stringify(j); // ‘{"name":"binchen"}‘
Convert JS object to JSON string,布布扣,bubuko.com
Convert JS object to JSON string
原文地址:http://www.cnblogs.com/shgq/p/3906906.html