parse nested json in php code example
Example 1: decode a nested JSON with php
foreach($json as $elem) {
echo( $elem['name']." - ".$elem['favourite']['colour'] );
echo("<br/>");
}
Example 2: php object into nested json object
{ "client": {
"build": "1.0",
"name": "xxxxxx",
"version": "1.0"
},
"protocolVersion": 4,
"data": {
"distributorId": "xxxx",
"distributorPin": "xxxx",
"locale": "en-US"
}
}