我有这样一个JSON:为什么我在获取json.length时未定义?
{"result":{"sandbox":1,"0":{"id":1106,"url":"http:\/\/www.example.com\/index1.html"},"1":{"id":9655,"url":"http:\/\/www.example.com\/index2.html"},"2":{"id":8447,"url":"http:\/\/www.example.com\/index3.html"}}}
,我检索,然后这样做:
var json = JSON.parse(data);
console.log(json.length);
但控制台输出“不确定”,即使当我刚登录(JSON)它显示了我的对象。为什么?我怎样才能得到这个长度?我需要它for循环