【发布时间】:2016-03-12 16:26:51
【问题描述】:
我的 Volley 请求可以返回为 JSONArray(有效)或 JSONObject(错误消息),为了正确显示错误响应,我想将失败的 JSONArray 字符串解析为 JSONObject。似乎 JSONException 对象包装了原始文本。是否可以只获取失败的文本以进行不同的解析?
例子:
org.json.JSONException: Value {"error":"User has not signed up to be a customer"} of type org.json.JSONObject cannot be converted to JSONArray
我只想获取 JSON 字符串组件,因为它是一个有效的 JSONObject。
【问题讨论】:
-
您的错误是与
HTTP 200一起出现的还是您获得了特定的状态码?
标签: android-volley jsonobject jsonexception