JSON (repeated Cr into pT Object Notation)
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-end javascr into pT can simply read JSON data through eval ().
3. Supports multiple languages, including actionscr platinum PT, C, C #, ColdFusion,Java, Javascr ī PT, Perl, PHP, Python, Ruby, and other language server-side languages for server-side Parsing
4. In the PHP world, there have been PHP-JSON and JSON-PHP appear, so that PHP Serialized programs can directly call the. php server side.Object, Arrays, etc. JSON format can be directly generated to facilitate client access extraction.
In addition, PHP's pear class has been supported (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:
The XML format is not widely used and widely used. It is not as universal as XML.
Comparison Between XML and son:
XML:
<Menu id = "file" value = "file">
<Popup>
<Menuitem value = "new" onclick = "createnewdoc ()"/>
<Menuitem value = "open" onclick = "opendoc ()"/>
<Menuitem value = "close" onclick = "closedoc ()"/>
</Popup>
</Menu>
Son:
{"Menu ":{
"ID": "file ",
"Value": "file :",
"Popup ":{
"Menuitem ":[
{"Value": "new", "onclick": "createnewdoc ()"},
{"Value": "Open", "onclick": "opendoc ()"},
{"Value": "close", "onclick": "closedoc ()"}
]}
}}
See the preceding figure:
1. The object is included in,
2. The member attribute of the object appears in pairs using string: value. The attributes and attributes are separated by commas,
3. The array is in [], for example, [elements].
4. Use commas to separate elements and elements.
5. Possible element values: String, number, object, array, true, false, null
Application Scope;
JSON is mainly used in Ajax. Because JavaScript scripts are used on the client, using JSON will make the process response faster.