Introduction to JSON and Java conversion JSON method

Source: Internet
Author: User

This article mainly tells the following several contents:

1, JSON definition and JSON features

2. How to interpret JSON-formatted data in JavaScript

3. How to use JSON in Java code (say object to JSON object and interpret JSON string)

One, JSON

There is a more detailed description of JSON on the http://www.w3school.com.cn/json/index.asp, linked to the link. Here are just a few important points.

JSON is a JavaScript Object notation (JavaScript objects notation), a lightweight text data interchange format with hierarchies (values in values), data that can be transmitted using AJAX, independent of language, and self descriptive, Smaller and faster and easier to parse than XML. JSON format strings are converted to JavaScript objects without a parser, JSON uses JavaScript syntax, and the eval () function of JavaScript is used to generate JavaScript objects.

Here's a JSON-formatted data, very clear, no need to explain, grammar please read the official document.

Standard JSON Format data

{"FirstName": "John", "LastName": "Doe"}

Standard JSON format array data

{

"Employees": [

{"FirstName": "John", "LastName": "Doe"},

{"FirstName": "Anna", "LastName": "Smith"},

{"FirstName": "Peter", "LastName": "Jones"}

]

}

or directly assigned to a variable:

var employees = [

{"FirstName": "Bill", "LastName": "Gates"},

{"FirstName": "George", "LastName": "Bush"},

{"FirstName": "Thomas", "LastName": "Carter"}

];

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/

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.