JSON (repeated Cr into pT Object Notation)

Source: Internet
Author: User
Tags pear pepr php server

JSON (repeated Cr into pT Object Notation)

Advantages:
1. The data format is relatively simple, easy to read and write, the format is compressed, and the bandwidth usage is small
2. It is easy to parse this language. The client-end javascr into pT can simply read JSON data through eval ().
3. Supports multiple languages, including actionscr platinum PT, C, C #, ColdFusion,Java, Javascr ī PT, Perl, PHP, Python, Ruby, and other language server-side languages for server-side Parsing
4. In the PHP world, there have been PHP-JSON and JSON-PHP appear, so that PHP Serialized programs can directly call the. php server side.Object, Arrays, etc. JSON format can be directly generated to facilitate client access extraction.
In addition, PHP's pear class has been supported (http://pear.php.net/pepr/pepr-proposal-show.php? Id = 198)
5. JSON format can be used directly for server-side code, which greatly simplifies the development of server-side and client-side code, but the completed tasks remain unchanged and easy to maintain.

Disadvantages:
The XML format is not widely used and widely used. It is not as universal as XML.

Comparison Between XML and son:

XML:

<Menu id = "file" value = "file">

<Popup>

<Menuitem value = "new" onclick = "createnewdoc ()"/>

<Menuitem value = "open" onclick = "opendoc ()"/>

<Menuitem value = "close" onclick = "closedoc ()"/>

</Popup>

</Menu>

Son:

{"Menu ":{

"ID": "file ",

"Value": "file :",

"Popup ":{

"Menuitem ":[

{"Value": "new", "onclick": "createnewdoc ()"},

{"Value": "Open", "onclick": "opendoc ()"},

{"Value": "close", "onclick": "closedoc ()"}

]}

}}

See the preceding figure:

1. The object is included in,

2. The member attribute of the object appears in pairs using string: value. The attributes and attributes are separated by commas,

3. The array is in [], for example, [elements].

4. Use commas to separate elements and elements.

5. Possible element values: String, number, object, array, true, false, null

Application Scope;

JSON is mainly used in Ajax. Because JavaScript scripts are used on the client, using JSON will make the process response faster.

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.