A, JSON and XML
1.JSON
JSON (JavaScript Object Notation) a lightweight data interchange format, having good properties and ease of quick-readable prepared. Data can be exchanged between different platforms. JSON using high compatibility, completely independent of the language text format, but also have habits similar to the C language (including C, C ++, C #, Java, JavaScript, Perl, Python, etc.) the behavior of the system. These properties make JSON an ideal data-interchange language.
2.XML
Extensible markup language (Extensible Markup Language, XML), for marking an electronic document to have a structured markup language, can be used to mark data, defined data types, allow a user to define their own markup language source language . Use XML DTD (document type definition) document type definition to organize data; a unified format, cross-platform and language, has become the industry-accepted standards.
XML is a Standard Generalized Markup Language (SGML) subset is ideal for Web transmission. XML provides a uniform method for describing and exchanging independent of applications or vendors of structured data.
3. advantages and disadvantages
json advantages: ① data format is simple, easy to read, is compressed format, occupies a small bandwidth;
② easy to parse, the client simply by JavaScript eval () JSON data reading;
③ supports multiple languages, including ActionScript, C, C #, ColdFusion, Java, JavaScript, Perl, PHP, Python, Ruby and other server-side language, easy to parse the server side;
④ Because JSON format can be used directly for the server-side code, greatly simplifying the amount of code development server and client, and complete the task the same, and easy to maintain.
json disadvantages: ① no XML so versatile; ②JSON format currently in the promotion of Web Service also is in the initial stage.
xml advantages:. ① unified format, standard; ② easy to remotely interact with other systems, data sharing more convenient
xml drawback: ①XML file large, complex file format, transmission bandwidth of accounting;
② server and client need to spend a lot of code to parse XML, resulting in server and client code becomes very complex and difficult to maintain;
XML parsing inconsistencies between different browsers ③ client mode, you need to repeat a lot of code;
④ server and client resources and time parsing XML spend more.