谁知道这个json怎么取值
{"status":0,"data":{"rw":{"7075":{"name":"\u5c0f\u4f1f\u4ed4","vip_level":"X","union_name":"\u5929\u5730\u4f1a","level":"XX","renown":"XXXX","ticket":"0","sum_fpower":"X","trend":0,"rank":1},"7617":{"name":"\u5b50\u6602","vip_level":"X","union_name":"\u5929\u5730\u4f1a","level":"XX","renown":"XXXX","ticket":"0","sum_fpower":"XXXXX","trend":0,"rank":2},"923":{"name":"\u8303\u5f0f\u4e4b\u9b42","vip_level":"XX","union_name":"\u96c7\u4f63\u519b","level":"XXX","renown":"XXXX","ticket":"0","sum_fpower":"XXXX","trend":0,"rank":3},"2288":{"name":"\u6b66\u53ef\u6101","vip_level":"X","union_name":"\u96c7\u4f63\u519b","level":"XX","renown":"XXXXX","ticket":"0","sum_fpower":"XXXX","trend":0,"rank":4},"186":{"name":"\u5b97\u4e2d\u9053","vip_level":"X","union_name":"\u96c7\u4f63\u519b","level":"XXX","renown":"XXXX","ticket":"0","sum_fpower":"XXXXX","trend":0,"rank":5},"767":{"name":"\u53c1\u8beb","vip_level":"XXX","union_name":"\u96c7\u4f63\u519b","level":"XXX","renown":"XXXX","ticket":"0","sum_fpower":"XXXXX","trend":0,"rank":6},"3463":{"name":"\u949f\u79bb\u73ca\u73ca","vip_level":"6XXunion_name":"\u96c7\u4f63\u519b","level":"XX","renown":"XXXX","ticket":"0","sum_fpower":"XXXX","trend":0,"rank":7},"1848":{"name":"\u94b1\u591a\u591a","vip_level":"XX","union_name":"\u5929\u5730\u4f1a","level":"XX","renown":"XXXXX","ticket":"0","sum_fpower":"XXXXX","trend":0,"rank":8},"759":{"name":"\u6697\u81ea\u5728\u5929","vip_level":"5XXunion_name":"\u96c7\u4f63\u519b","level":"XX","renown":"XXXX","ticket":"0","sum_fpower":"XXXX","trend":0,"rank":9},"4065":{"name":"\u970d\u6210\u8d25","vip_level":"6XXunion_name":"\u96c7\u4f63\u519b","level":"XX","renown":"XXXX","ticket":"0","sum_fpower":"XXXXX","trend":0,"rank":10}}}}
------解决方案--------------------
success:function(result){
alert(result.data.rw."7075");
}
/*"name":"\u5c0f\u4f1f\u4ed4","vip_level":"X","union_name":"\u5929\u5730\u4f1a","level":"XX","renown":"XXXX","ticket":"0","sum_fpower":"X","trend":0,"rank":1},"这个按理说就是你要的值了,如果要取特定的某一条还好。但是遍历的话你前边,7075,2288这些不具有顺序性,就不好办了。*/
------解决方案--------------------
success:function(result){
console.log(result.data.rw['7075']);
}
------解决方案--------------------用for...in不就可以了
var json={"name":"\u5c0f\u4f1f\u4ed4","vip_level":"X","union_name":"\u5929\u5730\u4f1a","level":"XX","renown":"XXXX","ticket":"0","sum_fpower":"X","trend":0,"rank":1};
for(var i in json){
alert(json[i]+'\n');
}
------解决方案--------------------首先纠正LZ几个错误,数据格式不对
纠正后取值代码
for(var i in obj.data.rw){
console.log(obj.data.rw[i]);
}
------解决方案--------------------你给的这个结构有问题。。rw键值数据的倒数第一【,"vip_level"
:"6XXunion_name"
:"\u96c7\u4f63\u519b","level":"XX",】,第二【,"vip_level"
:"5XXunion_name"
:"\u96c7\u4f63\u519b","level":"XX",】,第四条【,"vip_level"
:"6XXunion_name"
:"\u96c7\u4f63\u519b",】记录是错的,union_name键名称和vip_level混一起了,修改正确来
var o={"status":0,"data":{"rw":
{"7075":{"name":"\u5c0f\u4f1f\u4ed4","vip_level":"X","union_name":"\u5929\u5730\u4f1a","level":"XX","renown":"XXXX","ticket":"0","sum_fpower":"X","trend":0