20.1 Chapter JSON syntax

Source: Internet
Author: User

1, grammar

JSON has three kinds of values

simple values: using the same syntax as JavaScript, you can represent strings, numeric values, Booleans, and Null in JSON. However, JSON does not support special value undefined in JavaScript.

object: An object as a complex data type that represents a set of unordered key-value pairs. The value in each key-value pair can be a simple value, or it can be a value of a complex data type.

Array: A group of numbers is also a complex data type that represents an ordered set of worthwhile lists that can be accessed by a numeric index. The value of an array can also be any type-----simple value, object, or array.

1. Simple values

5//Number

"HELLO World"//String

2. Objects

The objects in JSON are somewhat different from those in JavaScript, in fact the structure of objects in JSON is the same as dictionaries in other languages. Here is the representation of the object in JavaScript

var person = {

Name: "Zhangsan",

Age:29

}

In JSON, the standard notation is

var person = {

"Name": "Zhangsan",

"Age": 29

}

3. Arrays

[

{

"Name": "Zhangsan",

"Person": {

}

},

]

20.1 Chapter JSON syntax

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.