json相当于给变量打包;
json和数组的区别:
json arr:
length: 没有 有
顺序: 无序 有序;
下标: 字符串 数字;
循环: for in for
var json = {a:12,b:13,d:14};
json删除一项: delete json.a
json 修改: json.a = 12;
json 增加: json.c = 20;
json可以传参;
小明:
var json={ //用json而不是用xiaoming
‘address‘:‘beijing‘, //用单引号包住
‘age‘:15,
‘job‘:‘student‘,
‘family‘:[
{‘dajie‘:‘xiaohong‘,
‘age‘:22,
‘job‘:‘hushi‘
},
{‘erjie‘:‘xiaolan‘,
‘age‘:20,
‘job‘:‘waiter‘
}
]
}
原文:http://www.cnblogs.com/yang0902/p/5697985.html