Android Programming experience Sharing--json learning process _android

Source: Internet
Author: User
Let me talk about Android programming, and as we learn about JSON, we all know that JSON, as a popular data interchange format, has many of its advantages, and is widely used in Android's Web applications, where the process of learning JSON is recorded as follows

This package has been introduced by default in the Android Android.jar package, where we can call it directly.
There are five basic types of JSON, namely Object,array,value,string,number
Object
Take the following as an example
{"Person": {"id": +, "Address": "Wuhan Hanyang District", "name": "Yang"}

{} represents an object that ends with {beginning with}: The name of the object before it is represented: the value of the object
So the example above represents the object of person, which has this {"id": "Address": "Wuhan Hanyang District", "name": "Yang"} A string of values

According to the official JSON explanation

Object
{}
{Members}
Members
Pair
Pair, Members
Pair
String:value

In turn, the members can include multiple key-value pairs, and multiple key-value pairs are separated by "," numbers
So the above example is in the person value object and includes the object name ID, value 100, etc.

Array
The above object is identified with {}, and array is identified by [], what data array can contain as an array, for example
["Beijing", "Shanghai", "Wuhan"]

The array contains three values "Beijing" "Shanghai" "Wuhan" separated by commas respectively.

Of course, we'll use more complex examples in practical applications.
such as [{"id": +, "address": "Beijing", "name": "John"},{"id": "", "Address": "Wuhan", "Name": "Dick"}]
Now the array contains not a string, but an object, according to the official introduction, the value of the string can contain the following types

Value
String
Number
Object
Array
True
False
Null
Value
Based on the two types of introductions, we find that there is value in each middle, and as a basic type, value can pass in multiple types of values, and the value behind each colon in the example above is

String
My understanding of this type is similar to the string type in our Java, which requires a "" package, and the official mentions that it can use \ Escape

Numebr
In the example below, 100 of the data type is number, note that it does not include 8 and 16
{"id": 100}

The most common usage comes first, and the next article describes how to implement JSON with code
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.