下订单时,我在食品配送应用程序中出错
public void resultAlert(String HasilProses) {
Log.e("HasilProses", HasilProses);
try {
JSONObject jsonObject = new JSONObject(HasilProses);
JSONArray jsonArray = jsonObject.getJSONArray("ORDER_PLACED");
for (int i = 0; i < jsonArray.length(); i++) {
JSONObject object = jsonArray.getJSONObject(i);
String error = object.getString("error");
int order_id = Integer.parseInt(object.getString("order_id"));
Constant_Api.order_id = order_id;
String message = object.getString("message");
dbhelper.deleteAllData();
if (payable>0) {
startPayment();
}
else{
lytOrder.setVisibility(View.GONE);
txtAlert.setVisibility(View.GONE);
recyclerView.setVisibility(View.GONE);
paymentUpdate("0");
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
我的 Logcat
错误和 JSON
响应
Failed{
"ORDER_PLACED": [
{
"error": "true",
"message": "Failed"
}
]
}
w/system.err:org.json.jsonexception:value failed of type java.lang.string无法转换为jsonobject
w/system.err:org.json.json.typemissmatch(json。java:112)在org.json.jsonobject.(jsonobject。java:168)
w/system.err:位于org.json.jsonobject.(jsonobject。java:181)
暂无答案!
目前还没有任何答案,快来回答吧!