JavaScript Object Notation (or JSON) is an open and text-based data exchange format. It provides a standard data exchange format and is more suitable for Ajax-style Web applications.
JSON: http://www.json.org/
Jayrock is an open-source lgpl software that implementsJSONAndJSON-RPC: supports the Microsoft ASP. NET Framework.
JSON + jayrock + ASP. NET Quick Start: http://jayrock.berlios.de/#quick-start
Introduction to JavaScript Object Notation (JSON) in JavaScript and. net
Features:Simple formatted data exchange
2. Easy reading and writing habits
3. Easy Machine Analysis and Operation
4. the eval () method can be used in JavaScript to conveniently read JSON data.
5. JSON-Supported languages: ActionScript, C, C #, ColdFusion, E, Java, JavaScript, ML, objective caml, Perl, PHP, Python, REBOL, Ruby, and Lua.
Syntax analysis:JSON can be used to encapsulate data. It is similar to the C language family, so it can be easily analyzed by the C language family.
1. The object is contained in a pair of {}, for example:
2. The object's attribute member uses a pair of [String: value]. The attributes and attributes are separated by commas, for example:
String: value, string: Value
3. array is included in a pair of [], for example:
[Elements]
4. Use commas to separate elements from elements.
Elements, Elements
5. Types of element values:
String, number, object, array, true, false, null
Example:
JSON
{"Menu ":{
"ID": "file ",
"Value": "file :",
"Popup ":{
"Menuitem ":[
{"Value": "new", "onclick": "createnewdoc ()"},
{"Value": "Open", "onclick": "opendoc ()"},
{"Value": "close", "onclick": "closedoc ()"}
]
}
}}
XML
<Menu id = "file" value = "file">
<Popup>
<Menuitem value = "new" onclick = "createnewdoc ()"/>
<Menuitem value = "open" onclick = "opendoc ()"/>
<Menuitem value = "close" onclick = "closedoc ()"/>
</Popup>
</Menu>
JSON vs XML· Readability: the readability of JSON and XML is comparable. One side is the suggested syntax and the other side is the standard label format, which makes it difficult to distinguish between the two. · Extensibility XML is inherently highly extensible, and JSON is also available. There is nothing XML can be extended, and JSON cannot. · Difficulty in coding XML has a variety of coding tools, such as dom4j and JDOM. JSON also provides tools provided by json.org, but JSON encoding is much easier than XML, JSON code can be written without tools, but it is not easy to write XML. · Difficulty in decoding XML parsing should consider the parent node of the child node, which is confusing, while the difficulty in JSON Parsing is almost 0. There is nothing to say about XML. · Popularity
XML has been widely used in the industry, and JSON is just the beginning. However, in the specific field of Ajax, the future development of XML must be in JSON. Then Ajax should be changed to ajaj (Asynchronous JavaScript and JSON.