I have a JSON
return, but I am not able to make a foreach
(PHP) on it, it gives this error:
Invalid argument supplied for foreach ()
Below is JSON
:
{
"categorias": {
"categoria": [
{
"id": "1",
"nome": "Chás e Ervas",
"subcategorias": [
{
"id": "1",
"nome": "Chás",
"descricao": "Lorem ipsum dolor sit amet, consectetur adipisicing elit."
},
{
"id": "2",
"nome": "Chimarrão",
"descricao": "Lorem ipsum dolor sit amet, consectetur adipisicing elit."
}
]
},
{
"id": "2",
"nome": "Condimentos e Especiarias",
"subcategorias": [
{
"id": "3",
"nome": "Azeites",
"descricao": "Lorem ipsum dolor sit amet, consectetur adipisicing elit."
},
{
"id": "4",
"nome": "Caldos",
"descricao": "Lorem ipsum dolor sit amet, consectetur adipisicing elit."
},
{
"id": "5",
"nome": "Conservas",
"descricao": "Lorem ipsum dolor sit amet, consectetur adipisicing elit."
}
]
},
{
"id": "3",
"nome": "Diet e Light",
"subcategorias": [
{
"id": "6",
"nome": "Açaí e Guaraná",
"descricao": "Lorem ipsum dolor sit amet, consectetur adipisicing elit."
},
{
"id": "7",
"nome": "Adoçantes",
"descricao": "Lorem ipsum dolor sit amet, consectetur adipisicing elit."
}
]
}
]
}
}