I am using the Alpha Vantage API
to get stock market data. The data is returned in this format:
For charting purposes, I need to create an array
or object
of all of the dates. They are not within the actual data objects so I'm not sure how to do this.
For example, for this specific data I would want an array that looks something like this:
['2021-04-26', '2021-04-26', '2021-04-26', '2021-04-26', '2021-04-26', '2021-05-03'...]
Thanks for the help!
CodePudding user response:
You can use Object.keys()
.
You didn't provide sample json, so this is formatted code and not a snippet.
const dates = Object.keys(data['Time Series (Daily)'])