JS in Json.stringify () and Json.parse () and eval () detailed and use case

Source: Internet
Author: User

JSON (JavaScript Object Notation) is a lightweight data interchange format. Because of the language-independent text format, also used similar to the C language family habits, with these features make JSON known as the ideal data exchange language, the role is easy to read and write, but also easy to machine parsing and generation (generally used for network transmission rate).

(1) json.parse function

function: Converts a JSON string into a JSON object.

Syntax: JSON. Parse (Text[,reviver]).

Parameter: text must be; a valid JSON string.

Reviver is optional.

Return value: An object or an array.

Example

(2) json.stringify () function  

Function: Converts a JSON object into a JSON string.

Syntax: json.stringify (value [, Replacer] [, space])

Parameter: value must be, usually an object or an array.

Replacer optional, function or array for converting results.

space is optional. Adds indents, spaces, and line breaks to the return value JSON text to make it easier to read.  

Return value: A string containing the JSON text.

Example

(3)

JS in Json.stringify () and Json.parse () and eval () detailed and use case

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.