0
我正在使用org.json将json字符串转换为xml和xml返回到json。我得到了只有键值对的json字符串的预期响应,但是包含jsonarray对象的json字符串包含的返回值与输入不同? 下面我使用的代码,在将JSON字符串转换为XML和XML时返回JSON字符串时出现错误的值
import org.json.JSONObject;
import org.json.XML;
String jsonStr ="........";
System.out.println("The JSON Raw Text :"+ jsonStr);
JSONObject jObject = new JSONObject(jsonStr);
String xml = org.json.XML.toString(jObject);
JSONObject xmlJSONObj = XML.toJSONObject(xml);
String jsonConvertString = xmlJSONObj.toString();
System.out.println("JSON text converted : "+jsonConvertString);
什么错误,或者什么是JSON字符串转换为XML和回JSON的最好方法?
您可以先在[google](http://www.google.com)中查找它,这里是一个链接http://stackoverflow.com/questions/2916495/libraries-to-convert-xml-into -json和 - 反之亦然 – StackFlowed 2014-10-09 13:27:15