So I have a response that returns data that looks like this:
{
"0": {
"name": "Novartis AG",
"symbol": "NVS",
"has_intraday": false,
"has_eod": true,
"country": null,
"stock_exchange": {
"name": "New York Stock Exchange",
"acronym": "NYSE",
"mic": "XNYS",
"country": "USA",
"country_code": "US",
"city": "New York",
"website": "www.nyse.com"
},
"stock": {
"open": 84.845,
"high": 85.39,
"low": 84.845,
"last": 85.33,
"close": 84.24,
"volume": 3700,
"date": "2022-01-27T14:40:00+0000",
"symbol": "NVS",
"exchange": "IEXG"
}
},
It is an object containing more objects, obviously. I have an interface that looks like this:
export interface Stock {
ticker: string;
name?: string;
open?: number;
high?: number;
low?: number;
last?: number;
close?: number;
}
What I am trying to do is get the response in my service call to be an array of Stock so:
getStocks(): Observable<Array<Stock>> {
...
}
I am having trouble coming up with a way to transform this singular object observable into an array of my Stock type observable. I really appreciate any help!