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 side and the client side require a large amount of moneyCodeXML parsing, regardless of the exception, complexity, and difficulty in 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 serialization afterProgramDirectly calling objects and arrays on the. php server can directly generate JSON format, which facilitates 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.