I'm trying to loop through my nested JSON and print the results but I get the aforementioned error when I try.
<?php
$json = json_decode($orderItems);
foreach ($json as $key) {
?><p>Product: <?php echo $json[$key] -> {'name'}; ?> | Quantity: <?php echo $json[$key] -> {'quantity'}; ?></p><?php
}
?>
print_r($json)
stdClass Object ( [Tom] => stdClass Object ( [name] => Tom [quantity] => 3 ) [Harry] => stdClass Object ( [name] => Harry [quantity] => 1 ) )