im new to json, I have the below code that works, my problem is the address field has 9 fields in it, anyone know how I can get parts of the address from $candidate->address e.g.
$address1 = '110 Middlesex Street'
$city = 'London'
$zip = 'E1 7HY'
-- my code -- '''
Candidate: '.$candidate->firstName.' '.$candidate->lastName.'
Email: '.$candidate->email.'
Address: '.print_r ($candidate->address).'
'''Output on the web page...
</head>
<body>stdClass Object
(
    [address1] => 110 Middlesex Street
    [address2] => 
    [city] => London
    [countryCode] => UK
    [countryID] => 2359
    [countryName] => United Kingdom
    [state] => Greater London
    [timezone] => 
    [zip] => E1 7HY
)
<div class="" style="">
    <p>Name: <span class="">David Kyloe</span></p>
    <p>Email: <span class="">me@home.co.uk</span></p>
    <p>Address: <span class="">1</span></p>
            
</html>
I have been trying loads of examples on-line, sadly I can't get them to work, the last example I found that's still not working is:
$json = $candidate->address;
$json = json_decode($json,true);
foreach ($json as $ad) {
    if ($ad['city'] == $city) {
        echo $ad;
    }
}
Thanks in advance.