Json.stringify ()

Source: Internet
Author: User

This function is a serialized object. is to convert the type of the original object into a string type (JSON type).

Syntax:
Json.stringify (value [, Replacer] [, space])
Value: is the required field. Is the object you have entered, such as array Ah, class AH and so on.
Replacer: This is optional. It is divided into 2 ways, one is method, the second is an array.

Situation one: We first say the data, through the experiment behind us, we can know that it is related to the first one. In general, our serialization results are represented by key-value pairs.
For example:
Name: "LAN", age:25
This form.
So, if this is the case, if the value of the second exists in the first, then the value of the second is the key, the first value for value is represented, if it does not exist, sorry, ignore. "It's not a bit abstract, I think so, but you just wait and see the experiment is OK." Whirring 】
Situation Two: If it is a method, it is very simple, that is, the serialization of each object (remember that every one) into the method of processing.
Space: Well understood, with what to do the delimiter.
1. If omitted, then the displayed value does not have a separator character. Direct output to
2. If it is a number, then it is defined to indent a few characters, of course, if it is greater than 10, the maximum value is 10.
3. If there are some escape characters, such as "\ T", which means carriage return, then it is a carriage return per line.
4. If it is just a string, OK, append the strings to the output value in each row. Of course, the maximum length is also 10 characters.

Example reference:

Http://www.jb51.net/article/29893.htm

Json.stringify ()

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.