var l=json.length
var arr; = [] ;
for(var i = 0; i (function(){
var jsonArray =arguments[0];
for(var k in jsonArray ){
if(k.indexOf('children') != -1 && jsonArray[k] != null){
arguments.callee(jsonArray[k]);
else {
if(k == '名前' || k == '子供'){
arr.push(jsonArray[k] '')
}
}
}
} )(json[i]);
}
JSON は次のようになります:
[{"id":"001","name":"上海市浦東新区","children":{"id" :"002","name ":"上海市徐匯区"}}]