Pro, do you use double quotes for your JSON key-value pairs?

Source: Internet
Author: User

JSON is a data structure that replaces XML, which is smaller and less descriptive than XML, and because of its compactness, the network transmits data to reduce traffic and speed up.

So, what exactly is JSON?

JSON is a string of strings except that the elements are labeled with a particular symbol.

{} Double brackets represent objects

[] brackets represent the array

"" In double quotes is a property or value

: A colon indicates that the latter is a value (the value can be a string, a number, or another array or object)

so {"name": "Michael"} can be understood as an object containing the name Michael

and [{"Name": "Michael"},{"name": "Jerry"}] represents an array containing two objects

of course, you can also use {"Name": ["Michael", "Jerry"]} to simplify the above, which is an object with a name array

PS: There are still a lot of people there are some misunderstanding, why {name: ' JSON '} in the test can not pass,
that's because the latest specification of the JSON official website

if it is a string, it is best to enclose the key or value in double quotation marks, so the above code is {"Name": "JSON"}

do not refute, the official website is so defined.


Pro, do you use double quotes for your JSON key-value pairs?

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.