More info: I forgot to mention that items like list_... are generated randomly
I have a text that I convert it to array using json
$tree = '{"list_Gentlemen":"root","list_Gold":"list_Gentlemen","list_Ladies":"root","list_Plata":"list_Ladies","list_Gold":"list_Ladies"}';
I convert it with
$tree = json_decode($tree,true);
But the thing is that when I convert it to array echo $tree;
returns me
Array
(
[list_Gentlemen] => root
[list_Gold] => list_Ladies
[list_Ladies] => root
[list_Plata] => list_Ladies
)
I mean there's a repeat key [list_Gold]
, and it doesn't insert the repeated key. Is there a way to rename that key?
Array
(
[list_Gentlemen] => root
[list_Gold] => list_Gentlemen
[list_Ladies] => root
[list_Plata] => list_Ladies
[list_Gold] => list_Ladies
)
Thanks for your help.