日期:2014-05-17  浏览次数:20620 次

关于处理json
[ { "Text": "题目类型", "Type": "选项", "ChildList": [ { "Text": "单选", "Key": "s$$1_Tag23$116131_1878" }, { "Text": "多选", "Key": "s$$1_Tag23$116131_1879" }, { "Text": "判断", "Key": "s$$1_Tag23$116131_1880" } ] }, { "Text": "内容分类", "Type": "选项", "ChildList": [ { "Text": "食品安全", "Key": "s$$1_Tag24$116131_1881" }, { "Text": "低碳环保", "Key": "s$$1_Tag24$116131_1882" }, { "Text": "神马类型", "Key": "s$$1_Tag24$116131_1883" } ] }, { "Text": "难易级别", "Type": "选项", "ChildList": [ { "Text": "一般", "Key": "s$$1_Tag25$116131_1884" }, { "Text": "普通", "Key": "s$$1_Tag25$116131_1885" }, { "Text": "困难", "Key": "s$$1_Tag25$116131_1886" } ] }, { "Text": "题目数量", "Type": "文本", "ChildList": [ { "Text": "题目数量", "Key": "s$$1_Text28$116125_λ" } ] }, { "Text": "题目", "Type": "文本", "ChildList": [ { "Text": "题目", "Key": "s$$1_Text29$116128_λ" } ] } ] 



这段json格式的我想分解成

{ "Text": "题目类型", "Type": "选项", "ChildList": [ { "Text": "单选", "Key": "s$$1_Tag23$116131_1878" }, { "Text": "多选", "Key": "s$$1_Tag23$116131_1879" }, { "Text": "判断", "Key": "s$$1_Tag23$116131_1880" } ] }

{ "Text": "内容分类", "Type": "选项", "ChildList": [ { "Text": "食品安全", "Key": "s$$1_Tag24$116131_1881" }, { "Text": "低碳环保", "Key": "s$$1_Tag24$116131_1882" }, { "Text": "神马类型", "Key": "s$$1_Tag24$116131_1883" } ] }

…………
怎么分解?

------解决方案--------------------
JScript code

var text = [{ "Text": "题目类型", "Type": "选项", "ChildList": [{ "Text": "单选", "Key": "s$$1_Tag23$116131_1878" }, { "Text": "多选", "Key": "s$$1_Tag23$116131_1879" }, { "Text": "判断", "Key": "s$$1_Tag23$116131_1880"}] }, { "Text": "内容分类", "Type": "选项", "ChildList": [{ "Text": "食品安全", "Key": "s$$1_Tag24$116131_1881" }, { "Text": "低碳环保", "Key": "s$$1_Tag24$116131_1882" }, { "Text": "神马类型", "Key": "s$$1_Tag24$116131_1883"}] }, { "Text": "难易级别", "Type": "选项", "ChildList": [{ "Text": "一般", "Key": "s$$1_Tag25$116131_1884" }, { "Text": "普通", "Key": "s$$1_Tag25$116131_1885" }, { "Text": "困难", "Key": "s$$1_Tag25$116131_1886"}] }, { "Text": "题目数量", "Type": "文本", "ChildList": [{ "Text": "题目数量", "Key": "s$$1_Text28$116125_λ"}] }, { "Text": "题目", "Type": "文本", "ChildList": [{ "Text": "题目", "Key": "s$$1_Text29$116128_λ"}]}];
    alert(text[0].T