Case one:
{Key:value,key:value}
class person{ = "Zhang"; = "San Fung"; = +; } New Person (); System.out.println (p.firstname);
Turn JS:
var person = {"FirstName": "Zhang", "LastName": "Three Abundant", "age": // Remove LastName alert (person.lastname); // Remove Age alert (person.age);
Case TWO:
[{Key:value,key:value},{key:value,key:value}]
New Person[1]; New Person ("Zhang", "San Feng", "three" );new person ("Li", "Four", " persons[");0] = p0; persons[1] = P1; System.out.println (persons[0].age); System.out.println (persons[1].firstname);
Turn JS:
var persons = [ {"FirstName": "Zhang", "LastName": "Sanfeng", "age": +}, {"FirstName": "Li", "LastName": "Four", "Age": [+ ]] ; // Take out Fistname= Lee Alert (persons[1].firstname); // Remove age=100 alert (persons[0].age);
Case THREE:
{
"param": [{Key:value,key:value},{key:value,key:value}]
}
var json = { "Baobao" :[{ "name": "YG", age:22, "addr": "Nantong" }, { "name": "Gy", age:22, "addr": "Xuzhou" }] }; // take name = Gy alert (json.baobao[1< Span style= "COLOR: #000000" >].name); // take addr = Nantong alert (json.baobao[0< Span style= "COLOR: #000000" >].addr);
Case FOUR:
{
' param1 ': [{key:value,key:value},{ Key:value,key:value}],
"param2": [{key:value,key:value},{key:value,key: Value}],
"param3": [{key:value,key:value},{key:value,key:value}]
}
var json = { "Baobao" :[{ "name": "YG", age:22, "addr": "Nantong" }, { "name": "Gy", age:22, "addr": "Xuzhou" }], "Haohao": [{"Name": "XH", age:23, "addr": "Nanjing" }, { "name": "AJ", Age:22, "addr": "Huaiyin" }]}; // take name = Gy alert (json.baobao[1].name); // take addr = Huaiyin alert (json.haohao[1].addr);
Case FIVE:
{
"param1": "Value1",
"Param2": {},
"Param3": [{Key:value,key:value},{key:value,key:value}]
}
var json = { "Key1": "Value1", "Key2": {"FirstName": "Zhang", "LastName": "Sanfeng", "Age" : "Key3": [ {"name": "YG", age:22, "addr": "Nantong"}, {"name": "Gy", age:22, "Addr": "Xuzhou"} ] ; alert (json.key2.firstname); Alert (json.key3[1].age);
JSON format Example