I have a json file which will update every so often and an example of it is this;
{
"Meta Data": {
"1. Information": "Intraday (60min) prices and volumes",
"2. Symbol": "ASX:NAB",
"3. Last Refreshed": "2017-08-28 02:00:00",
"4. Interval": "60min",
"5. Output Size": "Compact",
"6. Time Zone": "US/Eastern"
},
"Time Series (60min)": {
"2017-08-28 02:00:00": {
"1. open": "30.3600",
"2. high": "30.4400",
"3. low": "30.3600",
"4. close": "30.4000",
"5. volume": "348096"
},
"2017-08-28 01:00:00": {
"1. open": "30.3800",
"2. high": "30.4100",
"3. low": "30.3500",
"4. close": "30.3500",
"5. volume": "251213"
}
}
I was wondering instead of calling
JSONObject example= (JSONObject) example2.get("2017-08-28 02:00:00")
every time i want the data from the object, is there a way of doing this in a loop? Dynamically changing the value of the .get?
I know how retrieve the data from the objects, i just dont know how to get the call the object without directly putting its name into the .get. The reason why it is a problem is because there will be hundreads of objects which have the format of "yyyy-MM-dd hh:mm:ss"
EDIT: I have added in the FOLLOWING code
Iterator<String> keys = example2.keys();
However eclipse is saying that is is an undefined method for a JSONObject