I've run into an issue when trying to access data from an API
I've tried a number of ways to read the info (keys, json array etc) but it doesn't seem to work.
One of the issues seems to be that I need to be able to call the objects by an index rather that a name as the names will differ between json calls.
What I need to be able to is the following.
Please check the json here
I need to be able to access the data highlighted in this image
So essentially i need access to the following in this example
0: > data > 0 > wh > "WH"
0: > data > 273 > wh > "0"
0: > data > 274 > wh > "3"
What I have at the moment is the following.
JSONObject league_table_data = jsonPart.getJSONObject("data");
Iterator<String> iter = league_table_data.keys();
while (iter.hasNext()) {
String key = iter.next();
try {
Object value = league_table_data.get(key);
Toast.makeText(this, value.getString("name"), Toast.LENGTH_SHORT).show();
} catch (JSONException e) {
// problem
}
}