mdn--javascript--Introduction--Chapter III Object--json--Knowledge Point Summary

Source: Internet
Author: User

1.

JSON:JavaScript Object notation(js objects notation)

To represent structured data as The standard format for JavaScript objects,

typically used to represent and transfer data on a Web site (some data is sent from the server to the client, so it can be displayed on a Web page )

Douglas Crockford ( proposed to promote the JSON)

Although it is based on JavaScript syntax, which can be used independently of JavaScript, many programming environments have the ability to read (parse) and generate json. (e.g. php)

A JSON object can be stored in its own file , which is simply a text file with the extension . JSON and MIME types It's Application/json.

2.json structure:

1. Object

A collection of name/value pairs:

name is of type string,

The value can be:string,number,object,array,trur,false,null

2. array of arrays

(ordered list of values)

3. format / type of data in JSON

Note: You must use the "" double quotation mark, and the control word such as "\/BFNRT to be added \ escaped, you can use \u+ Four-bit hexadecimal number to denote Unicode character

Note: You cannot use octal, hex, can use scientific notation

Double-precision floating point

Non- NaN or Infinity

4. text <----> object Conversion

Sometimes you can set the XHR return response to JSON format, using:

Request.responsetype = ' json ';

But sometimes you need to convert the format

    • Json.parse (): Accepts JSON objects in the form of text strings as arguments and returns corresponding objects.
    • Json.stringify (): Accepts a JSON object as a parameter and returns the form of an equivalent text string.

mdn--javascript--Introduction--Chapter III Object--json--Knowledge Point Summary

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.