What is JSON format

Source: Internet
Author: User

In the process of doing the university cloud platform, I can not find that we unified the JSON format, then what is JSON, today we come to explore. And as for the Baidu Encyclopedia explanation, to tell the truth I really do not understand. But by looking at the data,JSON is simply called objects and arrays in JavaScript, so these two structures are objects and arrays of two structures that can be represented by a variety of complex structures.

The structure of the JSON is based on the following two points

1. "Name/value" pairs are set in different languages, it is understood as objects (object), records (record), structure (struct), Dictionary (dictionary), hash table (hash table), key list (keyed list), etc.

in the simplest form, a "name/value pair" can be represented by a JSON such as the following:
1 {" FirstName ":" Brett "}
This example is very basic, and actually takes up more space than the equivalent plain text "name/value pair":
1 firstName=Brett
However, when multiple name/value pairs are strung together, JSON reflects its value. First, you can create records that contain multiple name/value pairs, such as:
1 {"firstName":"Brett","lastName":"McLaughlin","email":"aaaa"}
in terms of syntax, this has no significant advantage over name/value pairs, but in this case JSON is easier to use and more readable. For example, it makes it clear that the above three values are part of the same record, and that the curly braces make some of these values a connection.

2. Ordered list of values is understood in most languages array (array)

When you need to represent a set of values, JSON not only improves readability, but also reduces complexity. For example, suppose you want to represent a list of people. In XML, many start and end tags are required, and if you use a typical name/value pair (like the name/value pair you see in the previous article in this series), you must create a proprietary data format or change the key name to a form such as Person1-firstname. If you use JSON, you only need to group multiple records with curly braces together:
1 2 3 4 5 6 7 { " people ": [ {" firstName ": Brett", " LastName ":" McLaughlin "," email ":" AAAA "}, {" FirstName ":" Jason "," LastName ":" Hunter "," email ":" BBBB "}, {" FirstName ":" Elliotte "," LastName ":" Harold "," email ":" CCCC "} " }

Simply put, JSON can convert a set of data represented in a JavaScript object into a string, which can then be easily passed between functions, or in an asynchronous application passing a string from a WEB client to a server-side program. The string looks a bit odd (see a couple of examples later), but JavaScript is easy to explain, and JSON can represent a more complex structure than name/value pairs. For example, you can represent arrays and complex objects, not just simple lists of keys and values.

 

What is JSON format

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.