- json_decode: documentation ( source)
<?php
$json_string = <<<'EOT'
"{
"John": {
"status":"Wait"
},
"Jennifer": {
"status":"Active"
},
"James": {
"status":"Active",
"age":56,
"count":10,
"progress":0.0029857,
"bad":0
}
}"
EOT;
$json = json_decode($json_string, true);
foreach ($json as $key => $val) {
if(is_array($val)) {
echo "$key:\n";
} else {
echo "$key => $val\n";
}
}
//echo $json;