I have the following structure in JSON:
[
{
"id":"79",
"value":"val1"
},
{
"id":"88",
"value":["val1","val2","new"]
}
]
How to handle this cases? I've tried this but it only handle the first case:
<?php
$arr = json_decode($json_string);
$itemsList = new stdClass;
$i_d=0;
foreach ($arr as $key=>$arrj):
$itemsList->id[$i_d] = $arrj->id;
$itemsList->value[$i_d] = $arrj->value;
$i_d++;
endforeach;
?>
Thanks in advance.