How can I extract the colors of this json?
[{
"item1": "si",
"item2": "no",
"item3":
[
{
"color": "azul",
"tipo": "circulo"
},
{
"color": "rojo",
"tipo": "triangulo"
},
{
"color": "verde",
"tipo": "cuadrado"
}
]
}
]
This is what I do and if I extract item1 and item2, but in item3 it shows me the Array pabra.
$array = json_decode($data);
foreach($array as $colors=>$color){
echo "$colors:<br>";
while (list($clave,$valor)=each($color)){
echo "$clave=$valor<br>";
}
}