The goal here is to parse the JSON being fed from an API (don't have control over) into my own made array. And I have two issues:
I'm not sure how I could grab #2 value Under "Meta Data".
If I wanted to grab the first array called "Time Series (5min):" and place that into its own array, I'm just not sure. Would it be like
var bodyParsed = JSON.parse(data);
let bodyArray = bodyParsed['Time Series (5min:']
for (var i = 0; i < bodyArray.length; i++) {
firstArray.push([
bodyArray[i][0], //"1. open": "125.4800",
bodyArray[i][1], //"2. high": "125.4800",
])
}
The JSON Sample
var data = [
{
"Meta Data": {
"1. Symbol": "XXX",
"2. Last Refreshed": "2020-07-17 19:25:00",
"3. Interval": "5min",
},
"Time Series (5min)": {
"2020-07-17 19:25:00": {
"1. open": "125.4800",
"2. high": "125.4800",
"3. low": "125.4800",
"4. close": "125.4800",
"5. volume": "100"
},
"2020-07-17 19:05:00": {
"1. open": "125.2400",
"2. high": "125.2400",
"3. low": "125.2400",
"4. close": "125.2400",
"5. volume": "200"
},
"2020-07-17 19:00:00": {
"1. open": "125.4000",
"2. high": "125.4000",
"3. low": "125.2400",
"4. close": "125.2400",
"5. volume": "1048"
},
"2020-07-17 18:40:00": {
"1. open": "125.3000",
"2. high": "125.3000",
"3. low": "125.3000",
"4. close": "125.3000",
"5. volume": "248"
},
"2020-07-17 18:35:00": {
"1. open": "125.3500",
"2. high": "125.3500",
"3. low": "125.3000",
"4. close": "125.3000",
"5. volume": "399"
}
}
]