Answer the question
In order to leave comments, you need to log in
How to select data from array info [{...}, {...}, ...]?
Hello.
Using API (JSON response) I get some data.
Everything was successful until I ran into the need to get data from an array.
This array looks like this:
"info": [
{
"high": "1",
},
{
"high": "3",
},
{
"high": "2",
},
]
high
was one or they would be called by different names, I would get them like this: myVar = data.optInt("high");
where data
is JSONObject
in populate
. high1
write the first element of the array info
into a variable high2
- the second, etc.?
Answer the question
In order to leave comments, you need to log in
JSONArray array = data.toJSONArray(); //Или data.getJSONArray(String);
array.length();
array.getJSONObject(int);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question