var?RES =' {"list": [{"ID": 3010," Name ":"青海"," city list ":[{"ID ":3011," Name ":"西寧" },{ " ID。
var?dataObj?=?JSON . parse(RES);
var?listData?=?data obj . list;
var?cityAry?=?[];
for(var?I = 0;我& ltlistData.lengthi++){
var?tmp?=?list data[I];
var?城市?=?{
值:tmp.id,
text:tmp.name,
兒童:[]
}
for(var?j = 0;j & lttmp . city list . length;j++){
city.children.push({
值:tmp.cityList[j]。id,
text:tmp.cityList[j]。名字
})
}
cityAry.push(城市);
}
console . table(city ary);