1.Json Object Goto JSON string
Json.stringify (obj);
2.Json string-Passing JSON object
Json.parse (str);///The first $.parsejson (str);//The second, equivalent to Jquery.parsejson (str); eval (' (' + str + ') ');//The third (new Function (" return "+ str)" ();//Fourth
3. Examples
var obj={"One": "I am 1", "II": "I am 2"};var str= ' {"One": "I am 1", "one": "I am 2"} '; var obj1 = json.stringify (obj);//' {"One: "I am 1", two: "I am 2"} ' var a1 = Json.parse (str);///The first var a2 = $.parsejson (str);//The second, equivalent to Jquery.parsejson (str); var a3 = Eval (' (' + str + ') ');//the third var a4 = (New Function ("return" + str));//The result value of the fourth//chrome console is as follows A1object {one: "I am 1", II: "I am 2"}a2object {one: "I am 1", II: "I am 2"}a3object {one: "I am 1", II: "I am 2"}a4object {one: "I am 1", II: "I am 2"}
4. References
Http://www.jb51.net/article/35090.htm
Http://www.jb51.net/article/25987.htm
A summary of how JSON and JSON strings are converted to each other in JavaScript (4 ways to convert)