xml的话,可以采用XStream来转换。。。
也就是说,你可以先把json的文件内容转换成JavaBean(fastjson),然后再把JavaBean转换成xml(XStream)
网上都有XML和json互相转换的工具,在线就可以转换。注意XML必须有单一的根节点。<?xml version="1.0" encoding="UTF-8" ?>
<root>
<node>
<id>1</id>
<text>系统维护</text>
<children>
<id>user</id>
<text>人员维护</text>
</children>
<children>
<id>role</id>
<text>角色维护</text>
<iconCls>icon-reload</iconCls>
</children>
</node>
<node>
<text>开发维护</text>
<children>
<text>元数据</text>
<state>closed</state>
<children>
<text>编辑样式</text>
</children>
<children>
<id>dataview</id>
<text>数据视图</text>
</children>
</children>
<children>
<text>权限资源</text>
</children>
</node>
</root>
javajson字符串转成
xml可以用xstream
这个jar来转换,
首先要把json转成java对象,
再转成xml字符串.