将获取的json对象转换成xml数据格式
Posted guoshunwgs
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将获取的json对象转换成xml数据格式相关的知识,希望对你有一定的参考价值。
参考网址:http://blog.csdn.net/u013714419/article/details/24804337
public static void main(String[] args){
String json="";
JSONArray jsonObject = JSONArray.formObject(json);
XMLSerializer xmlSerial = new XMLSerializer();
String xml = xmlSerial.write(jsonObject);
System.out.println(xml);
}
=-=======jar包依赖
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20151123</version>
</dependency>
<!-- https://mvnrepository.com/artifact/xom/xom -->
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.ezmorph/ezmorph -->
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>1.0.6</version>
</dependency>
以上是关于将获取的json对象转换成xml数据格式的主要内容,如果未能解决你的问题,请参考以下文章