I'm trying to read multiple data from this JSON file but I keep getting various errors like; "Uncaught Error: Cannot use object of type stdClass as array in" or "Trying to get property 'title' of non-object in". Where am I doing wrong?
$jsonObject = '{
"@context": "http://schema.org",
"@type": "JobPosting",
"title": "UX Designer",
"url": "https://www.google.com",
"datePosted": "2019-03-15T16:38+00:00",
"validThrough": "2019-03-22T16:38+00:00",
"description": "Description",
"industry": "IT",
"employmentType": "Permanent",
"hiringOrganization": {
"@type": "Organization",
"name": "PCR",
"url": "https://www.google.com",
"logo": "https://www.google.com"
},
"jobLocation": {
"@type": "Place",
"address": {
"@type": "PostalAddress",
"addressLocality": "Acton Green",
"addressRegion": "London",
"postalCode": "W4 5YB",
"addressCountry": "GB"
},
"geo": {
"@type": "GeoCoordinates",
"latitude": "51.4937",
"longitude": "-0.275693"
}
}
}';
$baz = json_decode($jsonObject);
echo($baz[0]->addressRegion);