I have a call to a webservice which is returning json data. I use:
$response_json = json_decode ( $response );
If I print_r($response) I get this:
stdClass Object
(
[meta] => stdClass Object
(
[no_of_pages] => 3
[current_page] => 1
[max_items_per_page] => 250
[no_of_items] => 740
)
[data] => Array
(
[0] => stdClass Object
(
[orderid] => 322191645
[customer] => stdClass Object
(
[city] => FELIXSTOWE
I am trying to loop through the orders:
foreach($response_json as $orders) {
echo $orders.['data'].[0].['orderid'];
}
but I keep getting:
Catchable fatal error: Object of class stdClass could not be converted to string. I have also tried many other ways, but I just can't seem to access the data in a loop. Thanks in advance.