Detailed description of JSON conversion usage information set

Source: Internet
Author: User

The converted JSON contains a set of Mixed information that can be recognized by humans and computers. The proper presentation of human-readable content, such as the entry title, category tag, link title, and permission description, relies on a language context that must be properly saved during conversion to JSON.

If you have read the previous articles in this series, you should have a good understanding of the data format. The previous article explains how to properly use plain text and simple name/value pairs in many asynchronous applications. Data can be combined into the following form:

 
 
  1. firstName=Brett&lastName=McLaughlin&email=brett@newInstance.com  

In this way, you do not need to do anything else. In fact, the Web veteran will realize that the information sent through the GET request adopts this format.

Then, XML is discussed in this series. Obviously, XML is widely used in Ajax applications because it has received many positive and negative comments. For more information about how to use the XML data format, see the previous articles in this series:

 
 
  1. <request> <firstName>Brett firstName> <lastName>McLaughlin lastName> 
  2. <email>brett@newInstance.com email> request> 

The data here is the same as the data shown above, but this time the XML format is used. This is nothing remarkable; it is just another data format that enables us to use XML instead of plain text and name/value pairs.

This article discusses another data format, JavaScript Object NotationJSON ). JSON conversion looks familiar and unfamiliar. It provides another option. It is always good to select a wider range.

 
 
  1. { "people": [ { "firstName": "Brett", "lastName":"McLaughlin", "email": "brett@newInstance.com" },
  2.  { "firstName": "Jason", "lastName":"Hunter", "email": "jason@servlets.com" }, 
  3. { "firstName": "Elliotte", "lastName":"Harold", "email": "elharo@macfaq.com" }]}  

When using name/value pairs or XML, you actually use JavaScript to retrieve data from the application and convert the data to another data format. In these cases, JavaScript, as a data manipulation language, is used to move and manipulate data from Web forms, and convert the data into a format suitable for sending to the server program.

However, sometimes JavaScript is not just used as a formatting language. In these cases, the object in JavaScript is used to represent data, not only to put data from Web forms into the request. In these cases, extract data from the JavaScript Object and then put the data into the name/value pair or XML.

  • Describes the usage characters of a JSON object.
  • Summary of the usage tips and descriptions of the JSON definition method
  • Describes in detail the features of JSON structure formats
  • JSON numeric structure description
  • Brief Introduction to the use of JSON Asynchronization

In this case, JSON is suitable: JSON conversion allows you to easily convert JavaScript objects to data that can be sent along with the request either synchronously or asynchronously ). JSON conversion is not a magic bullet; however, it is a good choice for some very special situations.

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.