JSON Learning notes __js

Source: Internet
Author: User

JSON Syntax rules

The JSON syntax is a subset of the JavaScript object representation syntax.

• Data in name/value pairs

• Data separated by commas

• Curly Braces Save objects

square brackets to save an array

JSON value

The JSON value can be:

• Number (integer or floating-point)

• String (in double quotes)

• Logical value (TRUE or FALSE)

• Array (in square brackets)

• Objects (in curly braces)

NULL

Jsonobject = {

"Employees": [

{"FirstName": "John", "LastName": "Doe"},

{"FirstName": "Anna", "LastName": "Smith"},

{"FirstName": "Peter", "LastName": "Jones"}

],

"Employees2": [

{"FirstName": "John", "LastName": "DOESDGD"},

{"FirstName": "Anna", "LastName": "Smith"},

{"FirstName": "Peter", "LastName": "Jones"}

]

}

In the example above, the object "Employees" is an array that contains three objects.

Use method: Jsonobject.employees[0].lastname result is Doe

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.