The parse () and Stringfy () methods of JSON

Source: Internet
Author: User

1.json.parse;
Function: Converts a JSON string of JavaScript Object notation to an object ( string to object)
Syntax: Json.parse (text [, Reviver])
Text must be selected. A valid JSON string.
Reviver is optional. A function that transforms the result. This function is called for each member of the object.
Return value: JSON object

2.json.stringify
Role: A JSON string that converts a JavaScript JSON object to a JavaScript Object notation ( object to String)
Syntax: json.stringify (value [, Replacer] [, space]);
Value required is typically an object or an array
Replacer function or array with optional conversion result
Space is optional. Adding indents, whitespace, and newline characters returns the value of the JSON text for easier reading.
If space is omitted, the return value text is generated without any additional whitespace.
If space is a number, the return value has a blank text indent for the specified number at each level. If space is greater than 10 o'clock, the text indents 10 blanks.
If space is a non-empty string, such as "\ T", the return value text is indented with the character of the string at each level.
If space is a string greater than 10 characters, the first 10 characters are used.
return Value: The text string that the JSON contains.

The parse () and Stringfy () methods of JSON

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.