更多信息重命名重複鍵: 我忘了,更不用說像列表項_...是我一直在使用JSONPHP在JSON陣列
,我將其轉換爲數組文本隨機生成$tree = '{"list_Gentlemen":"root","list_Gold":"list_Gentlemen","list_Ladies":"root","list_Plata":"list_Ladies","list_Gold":"list_Ladies"}';
我把它轉換與
$tree = json_decode($tree,true);
但問題是,當我將其轉換爲陣列echo $tree;
return me
Array
(
[list_Gentlemen] => root
[list_Gold] => list_Ladies
[list_Ladies] => root
[list_Plata] => list_Ladies
)
我的意思是有一個重複鍵[list_Gold]
,它不插入重複鍵。有沒有辦法重命名該密鑰?
Array
(
[list_Gentlemen] => root
[list_Gold] => list_Gentlemen
[list_Ladies] => root
[list_Plata] => list_Ladies
[list_Gold] => list_Ladies
)
感謝您的幫助。
在這裏檢查:http://stackoverflow.com/ques tions/21832701/does-json-syntax-allow-duplicate-keys-in-an-object – Dekel