How to read JSONArray inside a JSONΑArray

I have the following data in header response and I need to get the value of name.

 [{"valuePos":6,"elements":[{"parameterCount":0,"name":"myVale"}]}

I'm trying to get it using the following code

 JSONArray token_header = new JSONArray (response.getHeaders("token"));
 JSONObject objectElements = new JSONObject(token_header.getJSONObject(0));
 String Element = objectElements.getString("Element");

However, I got the error org.json.JSONException: JSONObject["Element"] not found.



Read more here: https://stackoverflow.com/questions/66275298/how-to-read-jsonarray-inside-a-json%CE%91array

Content Attribution

This content was originally published by zinon at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: