Home >Web Front-end >JS Tutorial >What are the json data formats?

What are the json data formats?

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-07-01 11:03:1828755browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn