Есть такой json
Array ( [0] => stdClass Object ( [id] => 1 [name] => Ширина [value] => [{"name":"\u0448\u0438\u0440\u0438\u043d\u04301","value":1,"target":null,"alias":"","required":0,"showNull":0},{"name":"\u0448\u0438\u0440\u0438\u043d\u04302","value":2,"target":null,"alias":"","required":0,"showNull":0},{"name":"\u0448\u0438\u0440\u0438\u043d\u04303","value":3,"target":null,"alias":"","required":0,"showNull":0},{"name":"\u0448\u0438\u0440\u0438\u043d\u04304","value":4,"target":null,"alias":"","required":0,"showNull":0},{"name":"\u0448\u0438\u0440\u0438\u043d\u04305","value":5,"target":null,"alias":"","required":0,"showNull":0}] [type] => select [group] => 1 [published] => 1 [ordering] => 1 )
Пытаюсь разобрать массив лежащий в параметре value
foreach ($extra_fields[0]->value as $mydata) {
echo "<option name='".$mydata->value."'>".$mydata->name."</option>";
}
Но такой код не работает, как его сделать?
UPDATE
Нашел решение:
$extra_json = json_decode($extra_fields[0]->value);
foreach ($extra_json as $vr) {
echo "<option name='".$vr->value."'>".$vr->name."</option>";
}