extjs 三帖同一问题一共140,难道还是没人会这个问题,真的那么难吗(全天在线等)
先上之前帖子的连接:http://topic.csdn.net/u/20120514/10/0f63b3f1-26fb-4359-aadc-a776ca53cf70.html?seed=1771347999&r=78552610#r_78552610
http://topic.csdn.net/u/20120511/16/e1f77bc0-bb39-4efa-b745-71439e479813.html?seed=953100509&r=78543642#r_78543642
这三帖都是问关于extjs怎么读json的问题
再者说下之前被说帖子上的json不是正确的json,所以现在我发上正确的json数据,之前发上的json数据是我模拟的,主要是说明那层次问题,但这样要大家花更多的时间去弄,实在抱歉,现在三帖子一共140分,希望有大神帮帮忙啊
{
"json":[
{
"children":[
{
"children":[
{
"leaf":true,
"text":"aaaa"
},
{
"leaf":true,
"text":"bbbb"
}
],
"leaf":false,
"text":"nnn"
},
{
"children":[
{
"leaf":true,
"text":"ccc"
},
{
"leaf":true,
"text":"ddd"
}
],
"ids":15,
"leaf":false,
"text":"ooo"
},
{
"children":[
{
"leaf":true,
"text":"ggg"
},
{
"leaf":true,
"text":"hhh"
}
],
"leaf":false,
"text":"kkk"
},
{
"children":[
{
"leaf":true,
"text":"lll"
}
],
"leaf":false,
"text":"ppp"
},
{
"children":[
{
"leaf":true,
"text":"qqq"
},
{
"leaf":true,
"text":"cvbcvb"
}
],
"leaf":false,
"text":"nbbnmfgh"
},
{
"children":[
{
"leaf":true,
"text":"ertert"
},
{
"leaf":true,
"text":"uiouio"
},
{
"leaf":true,
"text":"m,.m,."
}
],
"leaf":false,
"text":"khjkj"
},
{
"children":[
{
"leaf":true,
"text":"bnmn"
},
{
"leaf":true,
"text":"rtytry"
}
],
"leaf":false,
"text":"po[op[o"
},
{
"children":[
{
"leaf":true,
"text":"fghfgn"
}
],
"leaf":false,
"text":"dfgfh"
}
],
"leaf":false,
"text":"test"
}
]
}
层次关系如下:
{
json[{
children[{
children[{
children[{
······
}]
}]
}]
}]
}
问题所在是主要多了个json层在外面,所以不知道怎么去读去让treepanel可以显示出来,这问题求了半个月啦,有网友叫我百度,得罪的说声,我百度得到就不用上论坛问啦,如果你只是想刷分,那请别这样,因为我真的很急,
求别在叫我百度去,上点实际的
[解决办法]
JSONArray json = new JSONArray();...json.add(list);j.optJSONObject(0).get("children"); // 获得第一个json对象-->获得该对象key为“json”的值