/*根据keyName(如:result.data.name),无限深度遍历获取keyValue*/
function getValueByDepthKeyName(jsonObj, keyName) {
var k = keyName.split(".");
var o = jsonObj;
for (var i = 0, len = k.length; i < len; i++) {
o = o[k[i]];
o = isJSON(o) ? JSON.parse(o) : o;
}
return o;
}
标签:jsonObj,name,len,keyName,keyValue,result,var From: https://blog.51cto.com/u_15920212/5962684