Судя по вашим var_dump()
...
array(3) {
[0]=> object(stdClass)#5030 (1) {
["color"]=> object(stdClass)#5029 (5) {
["displayName"]=> string(5) "Farbe"
["value"]=> string(12) "schwarz-blau"
["colorHexCode"]=> string(7) "#19181d"
["baseColor"]=> string(7) "schwarz"
["iconId"]=> string(8) "26183061"
}
}
[1]=> object(stdClass)#5032 (1) {
["version"]=> object(stdClass)#5031 (2) {
["displayName"]=> string(11) "Ausführung"
["value"]=> string(8) "RH 48 cm"
}
}
[2]=> object(stdClass)#5034 (1) {
["unknown"]=> object(stdClass)#5033 (3) {
["displayName"]=> string(7) "Unknown"
["value"]=> string(21) "27,5+ Zoll (69,85 cm)"
["name"]=> string(7) "unknown"
}
}
}
... объект цвета находится в первом элементе массива dimension
.
. Любой из этих методов будет работатьвыбор за вами.
Код: ( Демо )
$json = '{"variations":{"574294403":{"dimensions":{"dimension":[{"color":{"displayName":"Farbe","value":"schwarz-blau","colorHexCode":"#19181d","baseColor":"schwarz","iconId":"26183061"}},{"version":{"displayName":"Ausf\\u00fchrung","value":"RH 48 cm"}},{"unknown":{"displayName":"Unknown","value":"27,5+ Zoll (69,85 cm)","name":"unknown"}}]}}}}';
$data = json_decode($json);
$cSKU = '574294403';
//var_dump($data->variations->$cSKU->dimensions->dimension);
var_dump($data->variations->$cSKU->dimensions->dimension[0]->color);
echo "\n---\n";
$array = json_decode($json, true);
var_dump($array["variations"][$cSKU]["dimensions"]["dimension"][0]["color"]);
Вывод:
object(stdClass)#1 (5) {
["displayName"]=>
string(5) "Farbe"
["value"]=>
string(12) "schwarz-blau"
["colorHexCode"]=>
string(7) "#19181d"
["baseColor"]=>
string(7) "schwarz"
["iconId"]=>
string(8) "26183061"
}
---
array(5) {
["displayName"]=>
string(5) "Farbe"
["value"]=>
string(12) "schwarz-blau"
["colorHexCode"]=>
string(7) "#19181d"
["baseColor"]=>
string(7) "schwarz"
["iconId"]=>
string(8) "26183061"
}