Home > Web Front-end > JS Tutorial > Detailed introduction to json objects in js_javascript skills

Detailed introduction to json objects in js_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 16:32:48
Original
1285 people have browsed it

1.JSON (JavaScript Object Notation) is a simple data format that is more lightweight than xml. JSON is a native JavaScript format, which means that no special API or toolkit is required to handle JSON data in JavaScript.
The rules of JSON are simple: an object is an unordered collection of "name:value" pairs. An object starts with "{" (left bracket) and ends with "}" (right bracket). Each "name" is followed by a ":" (colon); "name/value" pairs are separated by "," (comma).

The rules are as follows:

1) Mapping is represented by colon (":"). Name:value
2) Parallel data are separated by commas (","). Name 1: Value 1, Name 2: Value 2
3) The mapped collection (object) is represented by curly brackets ("{}"). {Name1:Value1,Name2:Value2}
4) The collection (array) of parallel data is represented by square brackets ("[]").
[
{name1:value,name2:value2},

{name1:value, name2:value2}

]
5) The types that element values ​​can have: string, number, object, array, true, false, null

Five writing methods in 2.json:

1) Traditional way of storing data and calling data

Copy code The code is as follows:



2) The first style:
Copy code The code is as follows:



3) Second style:
Copy code The code is as follows:



4) The third style:
Copy code The code is as follows:



5) The fourth style:
Copy code The code is as follows:



6) The fifth style:
Copy code The code is as follows:


Related labels:
source:php.cn
Statement of this Website
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
Latest Issues
Backslash present in Json
From 1970-01-01 08:00:00
0
0
0
Get: Transfer JSON data
From 1970-01-01 08:00:00
0
0
0
mysql storage json error
From 1970-01-01 08:00:00
0
0
0
javascript - Problems with displaying json data
From 1970-01-01 08:00:00
0
0
0
Find matching integers in JSON.
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template