IOS字典到php数组


IOS Dictionary to php array

>我有像 IOS 字典一样

[{'"my_id_one'":16403,'"my_id_two'":7239}]

当我使用 json_decode 解码时,它会返回 null

解码它以将其转换为PHP数组的最佳方法是什么?

看看

stripcslashes()

$str = '[{'"my_id_one'":16403,'"my_id_two'":7239}]';
$str_unescaped = stripcslashes($str);
$array = json_decode($str_unescaped, true);
print_r($array);

这输出:

数组 ( [0] => 数组 ( [my_id_one] => 16403 [my_id_two] => 7239 ) )