当前位置 : 主页 > 编程语言 > java >

jQuery获取json键值

来源:互联网 收集:自由互联 发布时间:2021-06-28
在js里面获取json的键值对 var json={"name":"John","age":1};//method 1for(var key in json){ console.log(key); console.log(json[key])}//method 2$.each(json,function(i){ console.log(i); console.log(json[in]);})
在js里面获取json的键值对
var json={"name":"John","age":1};
//method 1
for(var key in json){
        console.log(key);
        console.log(json[key])
}
//method 2
$.each(json,function(i){
        console.log(i);
        console.log(json[in]);
})
网友评论