I am making an app in ionic 3 and I am trying to fetch data from an url.
This is my code in data.ts and my data provider:
   getVehicleStatus() {
    return this.http.get<VehicleStatus>(this.url);
  }
This is my vehicle class:
class VehicleStatus {
    status: string;
    plate: string;
    code: string;
    message: string;
}
I am calling the method into my home.ts file.
  ionViewDidLoad() {
    console.log(this.getStatus('test3'));
  }
  getStatus(plate: string) {
    this.dataService.getVehicleStatus()
      .subscribe((data: VehicleStatus) => this.vehiclestatus = [{ ...data }]);
  }
To test out if everything works I hard code a license plate number to log it into my chrome developer tools. It said 'Undefined'. 
This is how the json data looks like:
[{"status":"P","plate":"test2","code:"MGP150151","message":"fail"}
,{"status":"P","plate":"test3","code":"MGP160298","message":"fail"}
,{"status":"P","plate":"test4","code":"MGP140085","message":"succes"}
,{"status":"O","plate":"test5","code":"MGP150175","message":"succes"}]
I should get this object back:
{"status":"P","plate":"test3","code":"MGP160298","message":"fail"}
But it doesn't work and got the message undefined.
I have used the following source:
How can I search in the array and bind it to my HTML page in ionic 3?.
Can someone point me in the right direction?.
Kind regards .