怎么获取json数据
的有关信息介绍如下:获取json360问答数据
<script>
varjson=
[{"name":"Lee","sex":"male"},担团两类景许切志走来电{"age":"21","hobit":"baskeyball"}]
alert(json[0].name)
//json[0]就是{"name":"Lee","sex":"male"}
//json[1]就是{"age":"21","hobit":"baskeyball"}
</script>
<script>
Va浓研养乱华落费讨样承唱rjson=
[{"name":[{"firstname":"Lee","lastname":"min"}],"sex":"male"},{"age":"21","hobit":"baskeyball"}志]
alert(json[0丰计].name[0].firs把表长脸每末失保力盾阻tname);
//json[0]就是{"name":"Lee","sex":"male"}
//json[0].name[0]孙既就是{"firstname":"Lee","lastname":"m朝静销但茶停鲁句指刑in"}
//json五相片化承[1]就是{"age":"21","hobit":"baskeyball"}
</script>
补脑专用井严煤持步程又:json一般是对象的集合,相当于java的list集合一样,
语法:varjson=[{"name":"Lee","sex":"male"},{"hobit":"tennis"}]
//json最外面是中括号,里面是由花括号组成的聚叶想美对象,对象之间用逗号隔开,对象里面有属性,属性之间以逗号隔开