The analogy between JSON and XML

Source: Internet
Author: User
Tags php server

The analogy between JSON and XML

(1). Advantages and disadvantages of XML

<1>. Advantages of XML

A. Uniform format, in line with the standards;

B. Easy to interact with other systems remotely, data sharing is more convenient.

<2>. Disadvantages of XML

A.xml file is large, the file format is complex, the transmission occupies the bandwidth;

B. Both the server side and the client need to spend a lot of code to parse the XML, causing the server and client code to become unusually complex and difficult to maintain;

C. The way the client parses XML between different browsers is inconsistent, and many code needs to be written repeatedly;

D. The server side and client parsing XML spend more resources and time.

(2). The advantages and disadvantages of JSON <1>. The advantages of JSON:

A. Data format is relatively simple, easy to read and write, the format is compressed, occupy small bandwidth;

B. Easy to parse, client-side JavaScript can simply pass the eval () to the JSON data read;

C. Support multiple languages, including ActionScript, C, C #, ColdFusion, Java, JavaScript, Perl, PHP, Python, Ruby and other server-side language, convenient for server-side analysis;

D. In the world of PHP, there are already Php-json and json-php appear, partial to the PHP serialization of the program directly call, PHP server-side objects, arrays, etc. can be directly generated JSON format, convenient for client access extraction;

E. Because the JSON format can be used directly for server-side code, greatly simplifies the server-side and client code development, and the completion of the task is not changed, and easy to maintain.

<2>. The drawbacks of JSON

A. There is no XML format so popular and happy to use widely, without XML so universal;

The B.json format is now in the initial stage of promotion in Web service.

The analogy between JSON and XML

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.