How do I read this JSON file with PHP.
I tried this way, but it does not work.
<?php
$json_str = '{
"numero":"1000",
"log": {
"message": "testing connection to the target URL",
"level": "INFO",
"time": "10:24:05"
},
"responsavel": {
"nome":"Responsavel teste"
}
}';
$obj = json_decode($json_str);
foreach ($obj as $objeto){
echo "numero: ".$objeto->numero;
foreach ($objeto as $item){
echo "Mensagem: ".$item->message. " - ";
echo "Nível: ".$item->level. "</br>";
}
foreach ($objeto as $responsavel){
echo "NOME: ".$item->nome;
}
}
?>