JSON and json online resolution

Source: Internet
Author: User
Tags javascript eval

JSON and json online resolution
Bytes

I. JSON format:

JSON (JavaScript Object Notation) is a simple data format, which is lighter than xml. JSON is a JavaScript native format, which means that no special API or toolkit is required to process JSON data in JavaScript.
JSON rules are simple: the object is an unordered "'name/value' pair" set. The rules are as follows:

1) The ing set (object) is represented by braces. {Name 1: value 1, name 2: Value 2}
2) The set (array) of the parallel data is represented by square brackets. [{Name 1: value, name 2: Value 2}, {name 1: value, name 2: Value 2}]

Ii. parse JSON:

JSON is only a text string. It is stored in the responseText attribute.
To read JSON data stored in the responseText attribute, you must follow the JavaScript eval statement.

3. JSON_LIB

// Convert javaBean to json format:
JSONObject jsonObject = JSONObject. fromObject (javabean );

// Convert the javaBean ---> json format in the list set
JSONArray jsonArray = JSONArray. fromObject (list );

JSON string Filtering
JsonConfig jsonConfig = new JsonConfig ();
JsonConfig. setExcludes (new String [] {"pname "});
JSONArray jsonArray = JSONArray. fromObject (list, jsonConfig );


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.