First, JSON overview
JSON overview
-Json:javascript Object Notation,javascript, originally a syntax for creating objects in JavaScript
-now JSON has been isolated from JavaScript as a stand-alone string data representation, supported by almost all major languages such as Java, C #, C + +, PHP, OC, etc.
-JSON, as a lightweight text data Interchange format, has been widely used to store and exchange text data in a similar way to XML, but more concise, faster, and easier to parse than XML
JSON syntax rules
-JSON syntax is a subset of JavaScript object notation syntax:
-Data in name/value pairs
-Data separated by commas
-Curly braces to save objects
-square brackets to save the array
-The basic format of JSON data is "name/value" pairs
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7E/7A/wKioL1cCNsyCWi_VAAGU0m-fbME272.png "title=" Web.png "alt=" Wkiol1ccnsycwi_vaagu0m-fbme272.png "/>
Ii. use of JSON
JSON object
-JSON (JavaScript Object Notation) is a lightweight data interchange format
-a JSON string can describe an object. The specific syntax is:
-written in curly braces;
-can contain any number of "name/value" pairs separated by commas
-the "name" must be enclosed in double quotation marks, and the value must be enclosed in double quotation marks if the string is used
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7E/7E/wKiom1cCNwGTTvr1AACCw8VHflw680.png "title=" Web.png "alt=" Wkiom1ccnwgttvr1aaccw8vhflw680.png "/>
JSON array
-The JSON string can also describe an array, with the specific syntax
-Written in square brackets
-Where multiple values or objects can be included
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7E/7E/wKiom1cCN2WyzbVvAAGgiHQAVvg457.png "title=" Web.png "alt=" Wkiom1ccn2wyzbvvaaggihqavvg457.png "/>
Conversion of JSON documents to objects
-Use the Eval () function to parse a JSON text string into a JavaScript object
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/7E/7E/wKiom1cCN7eiz4KVAAC0vogey0Y040.png "title=" Web.png "alt=" Wkiom1ccn7eiz4kvaac0vogey0y040.png "/>650" this.width=650; "src=" http://s5.51cto.com/wyfs02/M02/ 7e/7a/wkiol1ccohrxov1qaafid15zqqm007.png "title=" Web.png "alt=" Wkiol1ccohrxov1qaafid15zqqm007.png "/>
Conversion of JSON documents to objects
-You can also use the Json.parse (string) method to parse a JSON string to get a JavaScript object
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7E/7A/wKioL1cCOOrz8cDYAABw9eCQWag793.png "title=" Web.png "alt=" Wkiol1ccoorz8cdyaabw9ecqwag793.png "/>
-Format JavaScript objects as JSON strings using the Json.stringify (jsobj) method
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7E/7E/wKiom1cCOFbgr-pgAACAhuGeinQ416.png "title=" Web.png "alt=" Wkiom1ccofbgr-pgaacahugeinq416.png "/>
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M01/7E/7E/wKiom1cCOG7AfNz4AAC-_ejc-lY727.png "title=" Web.png "alt=" Wkiom1ccog7afnz4aac-_ejc-ly727.png "/>
Summary: This chapter focuses on JSON (JSON overview, using JSON)
This article from the "Flying Ants" blog, declined to reprint!
JavaScript Ajax-5 JSON (JSON overview, using JSON)