How can i get data from my response ( JSON object in array ) and assign to a variable in my component. This is how my results look like. But what i want to do is, i want to get only the price data from all the objects in the results and display in the GetData:Array
results
Object 1
comment : "Games on sale"
Price: 100
Object 2
comment : "Animals on sale"
Price: 139
Object 3
comment : "Table on sale"
Price: 390
ts
this.http.getGameData()
.subscribe(data => {
this.ArrayLine = data;
})
//array
public GetData:Array<any> = [
{data: this.ArrayLine.price},
];
service
getGameData(){
let headers = new Headers();
let options = new RequestOptions({ headers: headers });
return this.http.get('http://eg.com',options)
.map((response:Response) => response.json());
}