Filter out special character in json

$str="`!@#$%^&*()_+[]\{}|;':\",./<>?";
$str=str_replace("\\","\\\\", $str);
$str=str_replace("\"","\\\"", $str);

read count : 258