JSON (JavaScript Object Notation) is a lightweight data interchange format

Source: Internet
Author: User

JSON

JSON (JavaScript Object Notation) is a lightweight data interchange format.

It is based on a subset of JavaScript (standard ECMA-262 3rd edition-december 1999).

JSON takes a completely language-independent text format, but also uses a similar idiom to the C language family (c, C + +, C #, Java, JavaScript, Perl, Python, etc.).

These features make JSON an ideal data exchange language. Easy to read and write, but also easy to machine parse and generate.

JSON SyntaxJSON syntax is a subset of JavaScript syntax.JSON Syntax RulesThe JSON syntax is a subset of the JavaScript object representation syntax.
    • Data in name/value pairs
    • Data is separated by commas
    • Curly braces Save Object
    • Square brackets Save Array
JSON name/value pairsThe writing format for JSON data is: name/value pairs. Names in name/value pairs are written in front (in double quotes), value pairs are written behind (also in double quotes), separated by colons:
"FirstName": "John"

This is easy to understand and is equivalent to this JAVASCRIPT statement:

Firstname= "John"

JSON ValueThe JSON value can be:
    • Number (integer or floating point)
    • String (in double quotes)
    • Logical value (TRUE or FALSE)
    • Array (in square brackets)
    • Object (in curly braces)
    • Null
Basic structure

JSON[1] structure has two kinds of structure [2] JSON is simply said to be objects and arrays in JavaScript, so these two structures are objects and arrays of two structures, through these two structures can represent a variety of complex structure 1, objects: objects in JS represented as "{}" in the content, Data structure is {Key:value,key:value,...} The structure of key-value pairs, in object-oriented languages, key is the property of the object, value is the corresponding property value, so it is easy to understand that the value method is the object. Key Gets the property value, the type of the property value can be a number, a string, an array, several objects. 2, array: The array in JS is the middle bracket "[]" in the content, data structure for ["Java", "JavaScript", "VB",...], the value way and all languages, using index get, the type of field value can be number, string, array, object several. Through the object, the array 2 kinds of structure can be combined into a complex data structure.JSON

The JSON(JAvaScript Object Notation) is a lightweight data exchange language designed by the Douglas Kest Rockwell Ford, It is text-based and easy for people to read.

Although JSON is a subset of JavaScript, JSON is a language-independent text format and uses some of the same habits as the C language family.

The JSON format is a subset of the 1999JavaScript programming Language, Standard ECMA-262 3rd Edition,

So you can read in JavaScript with eval() functions (JavaScript through the eval () call interpreter).

However, this does not mean that JSON cannot be used in other languages, and virtually all languages associated with web development have JSON libraries.

JSON is used to describe a data structure that exists in the following form.

    • Object: An object begins with "{" and Exits with "}". An object contains a series of non-sorted name/value pairs, with a "," partition between each name/value pair.
    • Name/value (collection): Separated by ":" between the names and values, the general form is:
{Name:value}

A name is a string;
A value can be a string, a numeric value, an object, a Boolean value, an ordered list, or a null value.

    • A sequence of values (Array): One or more values with "," Partition, using "[", "]" in the form of such a list, shaped like:
[Collection, collection]
    • Strings: A string of characters enclosed in "".
    • Value: A series of 0-9 numeric combinations that can be negative or fractional. You can also use "E" or "E" as an exponential form.
    • Boolean value: expressed as true or false.

In many languages it is interpreted as an array.

JSON (JavaScript Object Notation) is a lightweight data interchange format

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.