JSON related information and blog a lot, json everywhere, the recent project has been to use JSON, today there is no overtime, write down, is a summary of their own, a deep understanding of JSON.
No more nonsense, go straight to today's theme:
As the title: Today is the introduction of what is JSON, I believe all know, but write and do things the same, you have to slowly!!!
<: What is JSON:
JSON: (JavaScript Object Notation) is a graceful way to create JavaScript objects. JSON is also a lightweight data interchange format. JSON is very easy for people to read and write,
It also facilitates machine parsing and generation. JSON is a better solution for exchanging data in Ajax instead of XML.
(1), JSON constructs the structure:
1, "key/value" pairs of sets, in different languages, it is understood as objects, records, structures, dictionaries, hash tables ....
2, an ordered list of values, which I understand here (the majority of the language is understood as an array).
These are common data structures, in fact most computer languages support them in some form, which makes it possible for a data format to be exchanged between programming languages that are also based on these constructs.
(2), JSON specific expression form
1. The object is an unordered set of "key/value" pairs, with an object starting with "{" (opening parenthesis) and "}" ending with (closing parenthesis). Each name is followed by a ":" (colon), and a "name/value" pair used ","
(comma) segmentation,
2, an array is an ordered set of values, an array begins with "[" (Opening parenthesis), "]" ends with (closing parenthesis), and the values are separated by "," (comma).
3, the value can be a double-quoted character, numeric value, True, False, null, object, or array, these structures can be nested:
4. A string is a collection of any number of characters surrounded by double quotation marks, escaped with a backslash. A character is a separate string, and the string is very similar to the C or C # character A.
This figure is also difficult to draw, it is estimated that I am not used to drawing ah, but no way, the image is more intuitive, this evening to write here, accompany girl friend to go shopping, whining, the full text No line of code, if tomorrow night work early, write the second: JSON format and grammar, there is nothing wrong with the place , please correct me, welcome you d God shoot brick!!!