JSON learning notes page 1/2

Source: Internet
Author: User
Tags pepr

The xmlHttpRequest component is used as the interaction tool and XML as the data transmission format.

[XML]
Advantages of using XML as the transmission format:
1. unified format, compliant with standards
2. Easy remote interaction with other systems and convenient data sharing

Disadvantages:
1. XML file format is large, complex, and occupies bandwidth for Transmission
2. Both the server and client require a large amount of code to parse XML, regardless of the complexity and difficulty of maintaining the server and client code.
3. The method for parsing XML between different browsers on the client is inconsistent. You need to repeat a lot of code.
4. It takes resources and time for the server and client to parse XML


[JSON]
In addition to the XML format, there are no other formats. There is a lightweight data exchange format called JSON (JavaScript Object Notation) that can replace XML.

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 JavaScript can simply read JSON data through eval ().
3. Supports multiple languages, including ActionScript, C, C #, ColdFusion, Java, JavaScript, Perl, PHP, Python, Ruby, and other language server-side languages for server-side Parsing
4. in the PHP world, there has been a PHP-JSON and a JSON-PHP that facilitates PHP Serialized programs to call directly. PHP server objects and arrays can directly generate JSON format to facilitate client access extraction.
In addition, the PEAR class of PHP has proposed support (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:
1. It is widely used and widely used without the XML format. It is not as universal as XML.
2. The JSON format is still in the initial stage in Web Service promotion.

PS: It is said that Google's Ajax is made using the JSON + template.

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.