I do have problems with nested JSON array:
{
data: [
{
id: 630299,
weather: null,
.
.
.
homeTeam: {
id: 1384,
name: "Tromsø",
logo: "https://soccerama.pro/images/teams/NOR/1384.png",
twitter: null,
venue_id: 329,
coach_id: 142585,
chairman_id: null
},
Here is my code:
$sy_json_match_cal=file_get_contents('url');
$sy_match_cal = json_decode($sy_json_match_cal,true);
$sy_match_calendar = $sy_match_cal['data'];
foreach ($sy_match_calendar as $sy_objects) {
$sy_match_id = $sy_objects['id'];
$sy_hteam_id = $sy_objects['home_team_id'];
$sy_ateam_id = $sy_objects['away_team_id'];
$sy_kickoff = $sy_objects['starting_time'];
Those work great, but I have tried and googled a lot to get any results from the homeTeam data. No chance. This is what I tried (amongst others):
$sy_hteam_name = $sy_objects['homeTeam'][0]['id'];
I have already checked and tried solutions from How do I extract data from JSON with PHP?, but that didn't make it any better. Would be awesome if you might have a solution for me. Thank you very much!