使用
Laravel5.1
...
我正在尝试转换此JSON:
"[{"John Doe":"john.gmail.com"},{"Frank Smith":"frank@frank.com"},{"Jie Brent":"jie@gmail.com"},{"Jeffrey Manney":"jeff17@gmail.com"}]"
对此:
"[{"name":"John Doe", "email":"john.gmail.com"},{"name":"Frank Smith", "email":"frank@frank.com"},{"name":"Jie Brent", "email":"jie@gmail.com"},{"name":"Jeffrey Manney", "email":"jeff17@gmail.com"}]"
这是我的密码:
$users_storage = [];
foreach($rcf_and_rcfm_users as $key => $user){
$users_storage[][$key] = $user;
}
$users = json_encode($users_storage);
dd($users);
这个
$rcf_and_rcfm_users