The API is returning the following json:
{
"car1": [
{
"car_name": "audi",
"gear_box_type": "Automatic",
"num_of_seats": "2",
"num_of_doors": "3",
"imagePath": "/images/a3.png"
}
]
}
The following is my php code:
<select class="form-control" id="exampleFormControlSelect1">
<?php
$obj = new ApiHelper();
$result = $obj->CallAPI("GET","http://localhost:5000/cars", "NONE");
$jsondata = json_decode($result, true);
$car = $jsondata['car1'];
echo "<option>".$car."</option>";
?>
</select>
The output will be "Array". Image of select
I would like to know how I can access this array that is inside the json.
Any help much appreciated thanks.