JSON【 JavaScript Object Notation】
It is a data transmission format widely used for data interaction between web pages and servers.
JSON syntax:
- Data is key/value pairs.
- Data is separated by commas.
- Curly braces hold objects
- Square brackets hold arrays
Example:
{"sites":[ {"name":"Runoob", "url":"www.runoob.com"}, {"name":"Google", "url":"www.google.com"}, {"name":"Taobao", "url":"www.taobao.com"} ]}
JSON function:
1. JSON.parse(txt,reviver) Format the JSON format string into a JavaScript object, and the reviver callback function executes this function for each JavaScript object.
2. JSON.stringify(txt,reviver,space), reviver callback function, execute this function for each JavaScript object; space adds spaces and newlines to strings.
Reference document: http://www.runoob.com/js/js-json.html