0

I am using the Alpha Vantage API to get stock market data. The data is returned in this format: Raw Stock Data

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!

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
joseph
  • 11
  • 2

1 Answers1

-1

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)'])
programmerRaj
  • 1,810
  • 2
  • 9
  • 19
  • Thank you! That's exactly what I needed – joseph Sep 15 '21 at 16:27
  • 1
    Please refrain from answering such obvious duplicates. Instead, find the duplicate and flag the question as such, or, if it's already got a comment starting with "Does this answer your question?" follow the link that comes after that comment, and if the answers answer this question, flag this question. – Heretic Monkey Sep 15 '21 at 16:57