JSON is a string used to transfer data, involving how to turn JS into a JSON string: stringify () converts a JSON string into a js:parse () and a eval_r () difference between the parse and eval: eval: Can parse any string into JS (will also parse the embedded Trojan) Parse: Only parse the JSON form of the string into JS and attributes in the string are strictly quoted (security is higher)
Eval: How to convert a string to JSON using var str= ' function show () {alert (123)} ' //String eval_r (str); , &NB Sp //the string into Jsalert (typeof show); , &NB sp;//can detect that show is already a function. Show (); , &NB Sp //Can execute Js //parse convert string to JSON using var str= ' function Show () {alert (123)} //String json.parse (str); show (); //Why don't you play it? This is the difference between parse and eval. Parse: Only parse the JSON form of the string into Js var str1= ' {"name": "Hello"} ';//each attribute is quoted, and Parse is a strict var json = Json.parse (STR1);Convert String to JS//alert (json.name) //deep copy recursive//stringify: Parse js into strict form JSON string var a={name:{ Age:100}};//jsvar Str=json.stringify (a);//Use the Stringify property of JSON to turn object A into a string//alert (str)//string var b=json.parse (str);// And the string into the object B.name.age=200;//alert (a.name.age) //ie678 incompatible JSON, need to call json2.js to do compatibility//flavor Video Name: Object reference
What is JSON and what to do with it