I have some data coming from rest API where the model property of myobject is an array, but when I map it via creating service it converts it to string. Please see my code below.
//from inteface =>
export interface Car{
make:string;
model :Array<any>;
}
//from service =>
getCars():Observable<Car[]> {
return this._http.get(this._getUrl)
.map(response=>response.json())
}
//from component= >
this._carservice.getCars()
.subscribe(cars=> {
this.cars = cars;
for(var i = 0; i<this.cars.length;i++){
console.log(this.cars[i].Model)
}
});
// OutPut
"Saloon,Estate,Coupe"
//required OutPut
[Saloon,Estate,Coupe]