1> Conversion methods supported by jQuery plug-in:
$.parseJSON(jsonstr); //jQuery.parseJSON(jsonstr), you can convert json string into json object
2> Conversion supported by browser Method (Firefox, chrome, opera, safari, ie9, ie8) and other browsers:
JSON.parse(jsonstr); //You can convert a json string into a json object
JSON.stringify(jsonobj); //You can convert a json object into a json string
Note: ie8 (compatibility mode), ie7 and ie6 do not have JSON objects. It is recommended to use the official JSON method and introduce json.js.
3>Conversion methods supported by Javascript:
eval('(' jsonstr ')'); //You can convert json string into json object, please note that it needs to be in json The character is wrapped in a pair of parentheses
Note: ie8 (compatibility mode), ie7 and ie6 can also use eval() to convert the string into a JSON object, but these methods are not recommended. This method is unsafe and eval will execute json expression in a string.
4>JSON official conversion method:
http://www.json.org/ provides a json.js, such as ie8 (compatibility mode), ie7 and ie6 It can support JSON objects and their stringify() and parse() methods;
You can get this js at https://github.com/douglascrockford/JSON-js. Generally, json2.js is used now.