Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JSON Tutorial

JSON Tutorial


JSON: JavaScript Object NNotation (JavaScript Object Notation)

JSON is a syntax for storing and exchanging text information, similar to XML.

JSON is smaller, faster, and easier to parse than XML.

JSON is easy for humans to read and write.

Programming languages such as C, Python, C++, Java, PHP, and Go all support JSON.

JSON example

{

"

sites

"

:

[

{

"

name

"

:

"

Runoob Tutorial

"

,

"

url

"

:

"

www.runoob.com

"

}

,

{

"

name

"

:

"

google

"

,

"

url

"

:

"

www.google.com

"

}

,

{

"

name

"

:

"

Weibo

"

,

"

url

"

:

"

www.weibo.com

"

}

]

}

This sites object is an array containing 3 site records (objects).


What is JSON?


JSON - converted to a JavaScript object

The JSON text format is syntactically identical to the code for creating JavaScript objects.

Because of this similarity, without a parser, a JavaScript program can use the built-in eval() function to generate a native JavaScript object from JSON data.


JSON tools