JSON Details

JSON (JavaScript Object Notation) is a lightweight data interchange format. It makes it very easy to read and write. But also facilitate the analysis and generation machine. It is based on  JavaScript Programming Language  ,  3rd Edition Standard the ECMA-262 - December 1999  a subset. JSON with fully independent of the programming language of the text format, but also used the language habits of class C (including C, C ++, C #, Java, JavaScript, Perl, Python , etc.). These properties make JSON an ideal data-interchange language.

JSON is based on two structures:

JSON [1] structure two structures [2]
It simply is json javascript objects and arrays, so the two structures is the object and an array of two structures, two structures can be represented by a variety of complex structures
  • 1, the object: the object represented in js as "{}" enclosed content, the data structure {key: value, key: value, ...} of the key structure, in object-oriented languages, key property of the object, value of the corresponding property value, so it is readily understood that the method of the object value .key getting a property value, the type of the attribute values ​​may be numbers, strings, arrays, several objects.
  • 2, the array: the array is in the js brackets "[]" enclosed content, the data structure [ "java", "javascript", "vb", ...], the values ​​in the same way and all languages, obtaining an index, the type of field values ​​may be numbers, strings, arrays, several objects. After the object, an array of two kinds of structures can be combined into a complex data structures.
  • {
        "animals": {
            "dog": [
                {
                    "name": "Rufus",
                    "age":15
                },
                {
                    "name": "Marty",
                    "age": null
                }
            ]
    }

    JSON has the following form:

    Object ( Object) is an unordered "name / value pairs" collection. An object to "{" (left bracket) starts, "}" (right parenthesis) ends. Each "name" followed by a ":" (colon); "" name / value pairs "used between", "(comma).
    Array ( Array) is an ordered set of values (value) of. An array of "[" (left bracket) to start, "]" (right bracket) end. Use between value "," (comma).
    Value ( value) may be a string of double quotes string( ), value ( ),number , ,  , objects (object) or array (array). These structures can be nested.truefalsenull
    String ( String) is a set of any number of Unicode character by double quotes, backslash escape. A character (Character) i.e. a single character string (character string).
    JSON String ( String) String or Java and C are very similar.
    Values ( Number) value and also very similar to C or Java. Just do not use JSON value octal and hexadecimal format.
    At the same time, the blank may be added between any tag.

Guess you like

Origin www.cnblogs.com/hinux/p/11590093.html