org.json.JSONObject constructor not accepting what appears to be a valid JSON string org.json.JSONObject constructor not accepting what appears to be a valid JSON string json json

org.json.JSONObject constructor not accepting what appears to be a valid JSON string


You are trying to create a JSONObject, but what you are actually giving it is a JSONArray. Did you try creating a JSONArray instead?

Alternatively, you could wrap your array in an object so that you can create a JSONObject out of it.


I would suggest using the GSon library instead as it appears to be more full-featured.

In addition, it may be helpful to use this tool to test your data (your data is valid btw):