Detailed descriptions of various functions of JSON data

Source: Internet
Author: User

JSON data access is much simpler than XML data access. JSON data can be accessed just like JavaScript objects. For example, in the preceding JSON data, to access the name of the first student, you only need to write: StudentsJSON. student [0]. name.

Instance research
Yahoo provides us with an image search Web service with the URL: http://search.yahooapis.com/imagesearchservice/v1/imagesearch. This Web Service supports returning data in JSON format. The Web Service accepts the following parameters:

You only need to dynamically construct the URL and add it to the src attribute of the dynamically created script tag to obtain the JSON data returned by the Web service. The query results are all in the ResultSet. Result [0] array. After a Web page is created, you can directly open the web page and test it in IE, Firefox, and other browsers on the local machine.

Experiment results and Comparison
We can see that the dynamic script tag technology combined with the JSON data exchange format makes cross-origin access to Web services very easy. However, what are the advantages and disadvantages of using JSON data exchange format in Web Services over XML? The following is an analysis from five aspects.

  • Typical method for generating JSON metadata objects
  • In-depth analysis of problems related to the JSON format
  • Detailed instructions on JSON help
  • Summarize the typical methods for generating JSON metadata objects.
  • How to correctly use JSON cached data

Readability: the readability of JSON and XML is comparable. JSON adopts common syntax data structures, and XML uses standard labels. Scalability: XML is inherently highly scalable, and JSON is not inferior to XML.

Encoding difficulty: XML has a variety of encoding tools, such as Dom4j and JDom. JSON also provides tools provided by json.org, but JSON encoding is much easier than XML, JSON code can be written without tools, but it is not easy to write XML.

Decoding difficulty: the parsing of XML must take into account the parent node of the child node. The JSON parsing difficulty is almost 0. There is nothing to say about XML. Popularity: XML has been widely used in the industry, and JSON has just begun, but it is in the specific field of Ajax.

In the future, XML may need to be stored in JSON. Then Ajax should become Ajaj Asynchronous JavaScript and JSON.

Related Article

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.