我有一個JSON var
JavaScript的JSON多個按鍵
{
"total":4,
"page":1,
"pagesize":30,
"type":"associated_user",
"items":[
{
"user_id":2727,
"site_name":"Physics",
"user_creation_date":1300894372,
"association_id":"2fbcabe5-cd42-4f5b-821e-2f1475e42ade"
},
{
"user_id":3864,
"site_name":"TeX - LaTeX",
"user_creation_date":1298808016,
"association_id":"2fbcabe5-cd42-4f5b-821e-2f1475e42ade"
},
{
"user_id":5983,
"site_name":"Stack Apps",
"user_creation_date":1301323608,
"association_id":"2fbcabe5-cd42-4f5b-821e-2f1475e42ade"
},
{
"user_id":6260,
"site_name":"English Language and Usage",
"user_creation_date":1300449905,
"association_id":"2fbcabe5-cd42-4f5b-821e-2f1475e42ade"
}
]
}
正如你所看到的,也有items
塊中有四個site_name
鍵。我只能訪問第一個使用items[0].site_name
但如何訪問其他三個一個一個?
當你使用'items [1] .site_name'時,你會得到什麼? – 2011-04-03 11:49:48
done ........... – yolo 2011-04-03 11:51:56
你應該接受一個答案...... – 2011-04-03 11:53:47