我有這個json下面。我試圖使用json_decode獲取值。我得到了一些值,但是我在深度嵌套值方面遇到了問題。這裏是JSON:PHP:嵌套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"
}
}
}
]
}
我知道我可以通過這樣得到一個值:
foreach ($decoded_array['issue'][0]['fields']['people'] as $person) {
echo $person['emailAddress'];
}
然而,有一個簡單的辦法讓所有的「emailAddresses」鮑勃,約翰,傑克,坦率地說?
謝謝!