0
点赞
收藏
分享

微信扫一扫

java中xml转json


public static String xml2jsonString() throws JSONException, IOException {
InputStream in = XmlToJson.class.getResourceAsStream("test.xml");
String xml = IOUtils.toString(in);
JSONObject xmlJSONObj = XML.toJSONObject(xml);
return xmlJSONObj.toString();
}

主要方法:

JSONObject xmlJSONObj = XML.toJSONObject(xml);

 

举报

相关推荐

0 条评论