我有以下json响应,我想从中读取数据:
{
"Meta Data": {
"1. Information": "Daily Prices (open, high, low, close) and Volumes",
"2. Symbol": "MSFT",
"3. Last Refreshed": "2018-09-24",
"4. Output Size": "Full size",
"5. Time Zone": "US/Eastern"
},
"Time Series (Daily)": {
"2018-09-24": {
"1. open": "113.0300",
"2. high": "114.9000",
"3. low": "112.2175",
"4. close": "114.6700",
"5. volume": "25272154"
},
"2018-09-21": {
"1. open": "114.0000",
"2. high": "115.2900",
"3. low": "113.5100",
"4. close": "114.2600",
"5. volume": "71229698"
},
"2018-09-20": {
"1. open": "112.2800",
"2. high": "113.8000",
"3. low": "111.9300",
"4. close": "113.5700",
"5. volume": "23714512"
},
...
现在如何通过使用索引来获取Javascript中的值。 我已经尝试过以下行:
price = response['Time Series (Daily)'][1]['4. close'];
为什么这行不通? 我真的很感谢您的帮助:)