Home > Article > Web Front-end > What are the json data formats?
json has two data formats, namely: 1. Object format, "{"key1":obj,"key2":obj,"key3":obj...}"; 2. Array/ Collection format, "[obj,obj,obj...]".
The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.
json is a language-independent data exchange format. Using Json’s format and parsing can easily represent an object information. There are two formats of json:
①Object format: { "key1":obj,"key2":obj,"key3":obj...},
②Array/collection format: [obj,obj,obj...].
json is the abbreviation of JavaScript Object Notation. The word means JavaScript object notation. The json mentioned here refers to a data format similar to JavaScript objects. This data format is currently more popular. Gradually replacing the traditional xml data format.
Different from the json object, the attribute names and string values in the json data format need to be enclosed in double quotes. Using single quotes or not using quotes will cause errors in reading data. Another data format of json is an array, which is the same as the array literal in javascript.
[Recommended learning: javascript advanced tutorial]
The above is the detailed content of What are the json data formats?. For more information, please follow other related articles on the PHP Chinese website!