我有以下代码:
try {
JSONObject json = new JSONObject(data);
...
} catch(JSONException ex) {
if(LOGS_ON) Log.e(TAG, "Could not save data.", ex);
}
尽管传入的 json 字符串非常有效,但它会引发异常。例外情况如下:
org.json.JSONException: Value {"ShopId3Digit":"ww0","ServerTime":1426695017191,"SMSTelephone":"2104851130","SendPODAgain":true,"SendLocationAgain":true,"IsHUB":false,"AllowReceiptsAndDeliveries":true} of type java.lang.String cannot be converted to JSONObject
你看到我传入的 json 数据有问题吗?
顺便说一句,这是在 Eclipse 手表中看到的字符串:
"{\"ShopId3Digit\":\"ww0\",\"ServerTime\":1426695017191,\"SMSTelephone\":\"2104851130\",\"SendPODAgain\":true,\"SendLocationAgain\":true,\"IsHUB\":false,\"AllowReceiptsAndDeliveries\":true}"