码迷,mamicode.com
首页 > Web开发 > 详细

将获取的json对象转换成xml数据格式

时间:2017-01-20 16:06:16      阅读:338      评论:0      收藏:0      [点我收藏+]

标签:.json   depend   serial   object   格式   .com   out   org   对象   

参考网址: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数据格式

标签:.json   depend   serial   object   格式   .com   out   org   对象   

原文地址:http://www.cnblogs.com/21heshang/p/6322938.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!