I have a JSON text as response from a web API:
{
"code": 0,
"message": "Success",
"data": {
"invoiceId": "26825",
"additionService": [
2
],
"invoiceStatusTxt":"OK"
}
}
I'm using JSONParser
to get a JSONArray
from the additionService
key. But, it is showing a JSON error. My code is:
JSONObject RES = JSONParser.getJSON(URL_API);
JSONArray ob = RES.getJSONObject("data").getJSONArray("additionService");
The error messages are as follows:
W/System.err﹕ org.json.JSONException: No value for additionService
W/System.err﹕ at org.json.JSONObject.get(JSONObject.java:355)
W/System.err﹕ at org.json.JSONObject.getJSONObject(JSONObject.java:574)
i has used json parser before, when i get value from key invoiceId.. it work, i have problem with additionService –