You can see what JSON_json is.

Source: Internet
Author: User
You can see what JSON is and what JSON is.
JSON (Javascript Object Notation) is a lightweight data exchange format. Easy to read and write. It is also easy to parse and generate machines. It is based on a subset of Javascript Programming Language, Standard ECMA-262 3rd Edition-December 1999. JSON uses a completely language-independent text format, but it also uses a habit similar to the C language family (including C, C ++, C #, Java, Javascript, Perl, Python, and so on ). These features make JSON an ideal data exchange language.
The JSON concept is very simple, that is, the server directly generates Javascript statements, and the client directly uses the eval method to obtain this object after obtaining the object, which can save the parsing XML loss.

In XML format:

The Code is as follows:




1
Jackson
Http://www.jb51.net </url>
Welcome to Web.cn


2
Relkn
Http://www.jb51.net </url>
Web.cn focus on new Internet technologies


3
Kvogend
Http://www.jb51.net </url>
Jb51.net script home



Code:

The Code is as follows:




1
Jackson
Http://www.jb51.net </url>
Welcome to Web.cn


2
Relkn
Http://www.jb51.net </url>
Web.cn focus on new Internet technologies


3
Kvogend
Http://www.jb51.net </url>
Jb51.net script home




Use JSON:

The Code is as follows:


{Items :[
{
Id: 1,
Author: \ "Jackson \",
Url: \ "http://www.jb51.net \",
Content: \ "Welcome to Web.cn \"
},
{
Id: 2,
Author: \ "Relkn \",
Url: \ "http://www.jb51.net \",
Content: \ "Web.cn following new Internet technologies \"
},
{
Id: 3,
Author: \ "Kvogend \",
Url: \ "http://www.jb51.net \",
Content: \ "jb51.net script house \"
}
]};


Code:

The Code is as follows:


{Items :[
{
Id: 1,
Author: \ "Jackson \",
Url: \ "http://www.jb51.net \",
Content: \ "Welcome to Web.cn \"
},
{
Id: 2,
Author: \ "Relkn \",
Url: \ "http://www.jb51.net \",
Content: \ "Web.cn following new Internet technologies \"
},
{
Id: 3,
Author: \ "Kvogend \",
Url: \ "http://www.jb51.net \",
Content: \ "jb51.net script house \"
}
]};



JSON not only reduces the performance and compatibility issues caused by parsing XML parsing, but also is very easy to use for Javascript. It is convenient to retrieve data by traversing arrays and accessing object attributes, its readability is good, and it basically has the nature of structured data. I have to say that it is a good method. In fact, google maps does not use XML to transmit data, but uses the JSON scheme.

Another advantage of JSON is "cross-origin". For example, you can use

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.