Ben böyle bir JSON veri var:
{
"hello":
{
"first":"firstvalue",
"second":"secondvalue"
},
"hello2":
{
"first2":"firstvalue2",
"second2":"secondvalue2"
}
}
I (ilkDeger) ve ikinci (secondvalue) "ilk" nesne verileri almak nasıl biliyorum ama döngü Zati bu nesneyi istiyorum ve bunun sonucunda değerler olsun: "merhaba" ve "hello2" ...
Bu benim PHP kodu:
<?php
$jsonData='{"hello":{"first":"firstvalue","second":"secondvalue"},"hello2":{"first2":"firstvalue2","second2":"secondvalue2"}}';
$jsonData=stripslashes($jsonData);
$obj = json_decode($jsonData);
echo $obj->{"hello"}->{"first"}; //result: "firstvalue"
?>
Bu yapılabilir mi?