/** * 获取某一个json对象的某一行某一个key的value值 */ function getValueByKey (thekey, node){ for(var key in node) { if (key == thekey) { return node[key]; } } return null; } /** * 获取某一个json对象数组的某一行某一个key的value值 */ function getValueByKeyArray (thekey, nodes ,row){ if(nodes.length == 0){ return null; } for(var i = 0;i < nodes.length;i++){ if(i == row){ for(var key in nodes[i]){ if( key == thekey){ return nodes[i][key]; } } } } return null; }
js遍历json对象数组的key和value
猜你喜欢
转载自blog.csdn.net/blossomfzq/article/details/80826172
今日推荐
周排行