• 将获取的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>

  • 相关阅读:
    读后感
    mysql分库分表的基本方法
    pdo接口用法
    视频技术基础
    【原创】shell易错语法汇总
    php底层的运行机制
    mysql统计函数
    etc/shadow 登陆口令破解
    JAVA学习(方法重载)
    JAVA学习(方法的定义及调用)
  • 原文地址:https://www.cnblogs.com/21heshang/p/6322938.html
Copyright © 2020-2023  润新知