Recently in the development platform, to use JSON for data exchange, previously used JSON, but limited to ...
In the development platform, you will use the following JSON form:
Code Snippet 1:
{ "button":[ { "type": "Click", "name": "Today's song", "key": "V1001_today_music" }, { "type": "Click", "name": "Singer Profile", "key": "V1001_today_singer" }, { "name": "Menu", "Sub_button":[ { "type": "View", "name": "Search", "url": "http://www.soso.com/" }, { "type": "View", "name": "Video", "url": "http://v.qq.com/" }, { "type": "Click", "name": "Like Us", "key": "V1001_good" }] }]}
Then use PHP's Json_encode () function to convert the one or two-D array into JSON form
But the converted JSON form:
Code Snippet 2:
{ "button": { "1": { "type": "Click", "Name": "Today's Song", "Key": "V1001_today_music" } , "2": { "t Ype ":" click "," Name ":" Singer Profile "," Key ":" V1001_today_singer "} ," 3 ": { "name": "Menu", "Sub_button": [{ "type": "Vie W "," Name ":" Search "," url ":" http://www.soso.com/"} , { "type": "View", "Name": "Video", "url": "HT tp://v.qq.com/"} , {" type ":" Click ", "Name": "Like Us", "Key": "V1001_good" }]}}}
It is inconsistent to see the form.
Just look at the structure of the JSON.
JSON has two kinds of data: 1. Unordered object structure; 2. Ordered array structure
1. Unordered object structure
Unordered object structures are called differently in different languages, such as in Python, called a dictionary, and in JS called JSON objects ...
In short, the key/value pairs are combined form.
The JSON structure I switched out just now is an unordered combination of key/value pairs
2. Ordered array structure
An ordered array structure, which is the structure shown in code Snippet 2.
By converting the array to JSON as an ordered array, you can get an ordered JOSN array structure.
http://www.bkjia.com/PHPjc/771650.html www.bkjia.com true http://www.bkjia.com/PHPjc/771650.html techarticle recently in the development platform, to use JSON for data exchange, previously used JSON, but only in the development platform, to use the JSON form as follows: Code Snippet 1: {"button": ...