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