I have an objet JSON which is like this :
{"type":"champion","version":"5.22.3","data":
{"Thresh":{
"id":412,
"key":"Thresh",
"name":"Thresh",
"title":"the Chain Warden",
"image":{
"full":"Thresh.png",
"sprite":"champion3.png",
"group":"champion",
"x":336,
"y":0,
"w":48,
"h":48
}}
When I parse with this command :
$json = file_get_contents($Api_PATH);
$obj = json_decode($json);
I get all the datas but if i need to get only the datas in the image object, how can I do?
This is the vardump($obj) :
object(stdClass)#366 (3)
{
["type"]=> string(8) "champion"
["version"]=> string(6) "5.22.3"
["data"]=> object(stdClass)#365 (127) { ["Thresh"]=> object(stdClass)#369 (5) {
["id"]=> int(412)
["key"]=> string(6) "Thresh"
["name"]=> string(6) "Thresh"
["title"]=> string(16) "the Chain Warden"
["image"]=> object(stdClass)#368 (7) {
["full"]=> string(10) "Thresh.png"
["sprite"]=> string(13) "champion3.png"
["group"]=> string(8) "champion"
["x"]=> int(336)
["y"]=> int(0)
["w"]=> int(48)
["h"]=> int(48)
} }
I already tried: $obj->data->image --> Not working... (Undefined property: stdClass::$image)
I tried to foreach the 2 objects but any results...
foreach ($obj->data->image as $value) {
Error
}