桃花长相依
可以用正则$jsonStr = '{"db":"[{"0":"9","id":"9"},{"0":"9","id":"9"},]"}'; $jsonStr = preg_replace('/[\'"](\[.*?\])[\'"]/iU', '$1', $jsonStr);// 去除json串中,数组外的引号,将形如"[{...}]"替换成[{...}]$jsonStr = preg_replace('/,\s*\]/', ']', $jsonStr);// 去除json串中多余的逗号 字符串替换:$jsonStr = str_replace('"[', '[', $jsonStr);$jsonStr = str_replace(',]"', ']', $jsonStr);