Data types and JSON formats

Source: Internet
Author: User

"Reading notes" source http://www.ruanyifeng.com/blog/2009/05/data_types_and_json.html

Although this article is a bit long, but the content inside I think very good. The article mentions that "structurally, all data can eventually be decomposed into three types."

1. The final three types of data are divided into the following categories:

    The first type is scalar (scalar), which is a single string (string) or number (numbers), such as "Beijing", a separate word.

    The second type is the sequence (sequence), which is a number of related data that are tied together in a certain order, also called an array or list, such as "Beijing, Shanghai."

    The third type is mapping (mapping), a name/value pair (Name/value), which has a name and a value corresponding to it, also known as hash (hash) or dictionary (dictionary), such as "Capital: Beijing".

  

2. JSON Four Rules

    

1) The data is separated by commas (",").

2) The map is represented by a colon (":").

3) a set (array) of side data is expressed in square brackets ("[]").

4) The Set of Mappings (objects) are represented by curly braces ("{}").

Strings in JSON typically use double quotation marks

Such as:

[
{"City": "Beijing", "area": 16800, "Population": 1600},
{"City": "Shanghai", "area": 6400, "Population": 1800}
]

--the array represents a collection of ordered data, whereas an object represents a collection of unordered data.

Data types and JSON formats

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.