记录踩坑的点点滴滴
pom
<!-- JSONObject -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>
代码
//result为xml字符串
if (StringUtils.isNotBlank(result)) {
XMLSerializer xmlSerializer = new XMLSerializer();
String str = xmlSerializer.read(result).toString();
JSONObject results = JSONObject.fromObject(str);
System.out.println(results.toString());
}