I have this json below. I'm trying to get values using json_decode. I'm getting some of the values, but I'm having trouble with the deeply nested values. Here is the json:
{
"startAt": 0,
"issue": [
{
"id": "51526",
"fields": {
"people": [
{
"name": "bob",
"emailAddress": "[email protected]",
"displayName": "Bob Smith",
},
{
"name": "john",
"emailAddress": "[email protected]",
"displayName": "John Smith",
}
],
"skill": {
"name": "artist",
"id": "1"
}
}
},
{
"id": "2005",
"fields": {
"people": [
{
"name": "jake",
"emailAddress": "[email protected]",
"displayName": "Jake Smith",
},
{
"name": "frank",
"emailAddress": "[email protected]",
"displayName": "Frank Smith",
}
],
"skill": {
"name": "writer",
"id": "2"
}
}
}
]
}
I know I can get one value by doing this:
foreach ($decoded_array['issue'][0]['fields']['people'] as $person) {
echo $person['emailAddress'];
}
However, is there a simplistic way to get all the "emailAddresses" for bob,john,jake, and frank?
Thanks!