XML字符串转化json
public static String XMLTOJSON(String XMLContent,String tag)
{
XMLSerializer xmlSerializer = new XMLSerializer();
JSON json = xmlSerializer.read(XMLContent);
JSONObject obj = JSONObject.fromObject(json);
JSONObject jobj = obj.getJSONObject(tag);
}
注意:取得的jobj不一定是符合json可以简单的处理,当然下面不通用
JSONArray arr = null;
if(jobj.isArray()){
arr = jobj.getJSONArray("subOrderInfoList");
}else{
JSONObject obj0 = jobj.getJSONObject("subOrderInfoList");
arr = JSONArray.fromObject(obj0);
}