我有一个从这个JSON生成的对象:
{
"data": {
"Meta Data": {
"1. Information": "Monthly Prices (open, high, low, close) and Volumes",
"2. Symbol": "MSFT",
"3. Last Refreshed": "2017-08-18",
"4. Time Zone": "US/Eastern"
},
"Monthly Time Series": {
"2017-08-18": {
"1. open": "73.1000",
"2. high": "74.1000",
"3. low": "71.2800",
"4. close": "72.4900",
"5. volume": "285933387"
},
"2017-07-31": {
"1. open": "69.3300",
"2. high": "74.4200",
"3. low": "68.0200",
"4. close": "72.7000",
"5. volume": "451248934"
}
}
}
}
使用
Object.keys()
,我能够获取到键"Monthly time series",但是如何访问它内部的键呢?我想在"Monthly time series"键中运行一个for循环,遍历其中的键。我该怎么做呢?
Object.keys()
来访问一个非随机属性,比如"Monthly Time Series"
? - Andreasvar monthlyTimeSeries = object["data"]["Monthly Time Series"];
- Andreas