我想這個數組轉換如下圖所示轉換數組的數組到JSON
array_countries=array("20"=>array("cntryValue"=>"3","cntryLabel"=>"Egypt","value"=>"7","label"=>"Tanta"),
"21"=>array("cntryValue"=>"3","cntryLabel"=>"Egypt","value"=>"1000","label"=>"Other"),
"22"=>array("cntryValue"=>"80","cntryLabel"=>"India","value"=>"0","label"=>"All"),
"23"=>array("cntryValue"=>"80","cntryLabel"=>"India","value"=>"1","label"=>"Ahmedabad"));
成這種格式:
"3":{"Egypt":{"7":Tanta,"1000":"other"}},"80":{"India":{"0":"All","1":Ahmedabad}}
我使用PHP和無法弄清楚如何我可以做這個。我已經使用json_encode。但結果不正確。我使用PHP作爲我的語言。
在此先感謝
什麼是您的php代碼? – 2014-12-19 10:31:36