I know there are similar questions all over Stackoverflow, but I did not find any help for the problem I'm having.
I have this JSON:
[{ "name": "Name0", "services": [ [{ "Service": "Service00", "Description": "Desc00" }, { "Service": "Service01", "Description": "Desc01" }] ] }, { "name": "Name1", "services": [ [{ "Service": "Service10", "Description": "Desc10" }] ] }]
I loop through it with:
$quoteJson = json_decode($quoteJson); foreach($quoteJson as $mydata) { echo $mydata->name . "<br>"; foreach($mydata->services as $key => $value) { echo $value[$key]->Service . "<br>"; echo $value[$key]->Description . "<br>"; } }
And the result I get is:
Name0 Service00 Desc00 Name1 Service10 Desc10
I am not able to loop through the service elements, to get:
Name0 Service00 Desc00 Service01 Desc01 Name1 Service10 Desc10