I get this output from the API:
'Meta Data': {
'1. Information': 'Daily Prices (open, high, low, close) and Volumes',
'2. Symbol': 'ibm',
'3. Last Refreshed': '2021-01-15',
'4. Output Size': 'Compact',
'5. Time Zone': 'US/Eastern'
},
'Time Series (Daily)': {
'2021-01-15': {
'1. open': '128.2800',
'2. high': '129.2400',
'3. low': '127.6700',
'4. close': '128.3900',
'5. volume': '4905506'
},
'2021-01-14': {
'1. open': '128.0200',
'2. high': '130.1600',
'3. low': '127.5500',
'4. close': '128.9700',
'5. volume': '7503180'
},
'2021-01-13': {
'1. open': '129.1500',
'2. high': '129.7500',
'3. low': '126.4550',
'4. close': '126.9200',
'5. volume': '7677739'
},
'2021-01-12': {
'1. open': '129.0900',
'2. high': '129.8500',
'3. low': '127.9400',
'4. close': '129.2100',
'5. volume': '3729068'
},
'2021-01-11': {
'1. open': '127.9500',
'2. high': '129.6750',
'3. low': '127.6600',
'4. close': '128.5800',
'5. volume': '5602466'
},
'2021-01-08': {
'1. open': '128.5700',
'2. high': '129.3200',
'3. low': '126.9800',
'4. close': '128.5300',
'5. volume': '4676487'
}
}
}
and I need to extract data from the first object in Time Series (Daily), but I have to know the date like this:
var price = data["Time Series (Daily)"]["2021-01-15"]["1. open"];
to get back 128.2800
It isn't an array so I can't do something like: var price = data["Time Series (Daily)"][1]["1. open"];
Does anyone how to do it?