I have a below JSON Array and I am trying to parse it but it is giving me an exception:
[{
"response": {
"client": "123456",
"111": {
"data": "0\u00181535480381\u00191535480347\u0018\"voyager\";-1;12;0\u00181535480075\u00191535480069",
"time": "981542121421"
}
}
}]
I am using org.json.JSONArray to parse the above JSON but below code throws exception:
String json =
"[{ \"response\": { \"client\": \"123456\", \"111\": { \"data\": \"0\u00181535480381\u00191535480347\u0018\"voyager\";-1;12;0\u00181535480075\u00191535480069\", \"time\": \"981542121421\" } } }]";
// this line throws exception
JSONArray jsonArray = new JSONArray(json);
Here is the exception I am seeing:
Exception in thread "main" org.json.JSONException: Expected a ',' or '}' at character 81
at org.json.JSONTokener.syntaxError(JSONTokener.java:410)
at org.json.JSONObject.<init>(JSONObject.java:222)
at org.json.JSONTokener.nextValue(JSONTokener.java:344)
at org.json.JSONObject.<init>(JSONObject.java:205)
at org.json.JSONTokener.nextValue(JSONTokener.java:344)
at org.json.JSONObject.<init>(JSONObject.java:205)
at org.json.JSONTokener.nextValue(JSONTokener.java:344)
at org.json.JSONArray.<init>(JSONArray.java:125)
at org.json.JSONArray.<init>(JSONArray.java:157)
What is wrong I am doing here?
datafield. My guess is that this has something to do with that.voyagerinside my json.