请把下面的xml格式改写能json格式:
<?xml version="1.0"?>
<container>
<node id="0" text="技术部">
<node id="4" text="研发组">
<node id="3" text="程序员" />
<node id="5" text="测试员" />
</node>
<node id="2" text="实施组" />
</node>
<node id="1111" text="销售部" />
</container>
<?xml version="1.0"?>
<container>
<node id="0" text="技术部">
<node id="4" text="研发组">
<node id="3" text="程序员" />
<node id="5" text="测试员" />
</node>
<node id="2" text="实施组" />
</node>
<node id="1111" text="销售部" />
</container>
解决方案 »
- JS如何动态预览外部字体~~~~~~
- jquery中ready里面的函数为什么对外不可见?这里我写了个测试描述此问题!
- 如何在JS里获得客户端的IP地址?
- 一个页面,有个按钮,点击后可以查找 访问者的机器里 是否 安装了某个程序!也就是有没有XXX.exe文件?
- 如何用方向键切换表单中各个input type="text"
- innerHTML的用途是什么?name与id属性有什么区别?
- 怎样屏蔽掉键盘的f1,f2,f3,f4换成自己的定义的功能
- 如何把IE设置为没有工具条,没有菜单条的风格
- 怎么用javascript來刪除選擇菜單里的所有內容(選項)
- 请大家看看,版主帮忙!!
- 表单禁止提交后,再允许提交,无法进入后台代码的问题
- iframe放大内容,动态实现后面
"3", "text": "程序员" }, {"id": "5", "text": "测试员" } ], "text": "研发组" }, {
"id": "2", "text": "实施组" } ], "text": "技术部" }, {"id": "1111", "text": "销
售部" } ] }}
[
{ id: 0, text: 技术部, children:
[
{ id: 4, text: 研发组, children:
[
{ id: 3, text: 程序员, children: null },
{ id: 5, text: 测试员, children: null }
]
},
{ id: 2, text: 实施组, children: null }
]
},
{
id: 1111, text: 销售部, children: null
}
]
function showJson() {
var json = eval('[{ id: 0, text: "技术部", children:[{ id: 4, text: "研发组",children:[{ id: 3, text: "程序员", children: null },{ id: 5, text: "测试员", children: null }]},{ id: 2, text: "实施组", children: null }]},{id: 1111, text: "销售部", children: null}]');
alert(json);//如果输出是一个js的object就是对的,不对的是undefined
}
container:{
node:[
{
id:0,
text:'技术部',
node:{
id:4,
text:'研发组',
node:{
id:3,
text:'程序员'
}
}
},
{
id:5,
text:'测试员'
},
{
id:2,
text:'实施组'
},
{
id:1111,
text:'销售部'
}
]
}
}
这个地方的js可以!
children:[{ id: 4, text: "研发组",children:[{ id: 3, text: "程序员"},{ id: 5, text: "测试员"}],id: 2, text: "实施组"}],[{id: 1111, text: "销售部", children: null}]