In ReactJS I have used Fetch() to get https://query2.finance.yahoo.com/v8/finance/chart/M6E=F and am now trying to access the nested item that is stored in the json object called "actualData". Due to it using "0" in the path, I cannot find a way to drill down in the following line...
console.log(actualData.chart.result.0.meta.currency);
The code above errors because of the "0". How do I include that "0" to access the "currency" element under "meta"?
CodePudding user response:
Try with this. console.log(actualData.chart.result[0].meta.currency);
CodePudding user response:
the result is a array, so you should access data by index
actualData.chart.result[0].meta.currency