Json:javascript object Notation,javascript objects represent methods, similar to XML, for storing and exchanging textual information.
1. JSON meaning
JSON is a lightweight text data interchange format;
JSON is independent of language;
JSON is descriptive and easy to understand.
JSON Example:
{"Orders": [ {"orderId": "1", "ItemName": "Apple", "origin":{ "province": " Hainan ", " City ":" Haikou ", " Detailed address ":" Haikou Naka Ward No. 35th " } , {" orderId ":" 2 " , " ItemName ":" Banana " } ]}
2. Comparison of JSON and XML
A, all can be transferred
B, JSON is plain text, XML is defined by tags; JSON data is smaller
C, JSON can be self-describing, better readability
D, JSON read and write faster
E, JSON can be parsed directly using the eval () method of JavaScript
3. JSON syntax
A, the data is stored in the form of Key/value to: mapping
"Name": "Lily"
B, two sets of data between the use, segmentation
"Name": "Lily", "Age": 18
C, curly braces Save the object
{"Name": "Lily",
"Addr": {
"Country": "China",
"City": "Beijing"
}
}
D, square brackets Save the array
{"Employees": [ "FirstName": "John", "LastName": "Doe" }, "firstName": "Anna", " LastName ":" Smith " }, " firstName ":" Peter "," LastName ":" Jones " }]}
4. Other data transmission formats
Protobug:google Open source serialization framework for internal use, support, and open source
Thrift:facebook developed a cross-language lightweight RPC messaging and data exchange framework
5. Several commonly used JSON libraries
Gson,fastjson,jackson,json-lib
Resources:
1. JSON Chinese official website http://www.json.org/json-zh.html
2, w3cschool-json:http://www.w3school.com.cn/json/json_eval.asp
3. Oschina-json Format tool: Http://tool.oschina.net/codeformat/json
4, json.cn:http://www.json.cn/json/wiki.html
5, the contrast between protobuf,json,xml,binary,thrift: http://blog.sina.com.cn/s/blog_406127500102uy6e.html
6, several common JSON library performance comparison: http://blog.csdn.net/vickyway/article/details/48157819
Data transfer: JSON