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