Slash issue with json_encode. Why and how to solve it?
In PHP 5.4, you can use JSON_UNESCAPED_SLASHES
:
echo json_encode("2011/7/11", JSON_UNESCAPED_SLASHES);
Otherwise, you have to do some trivial post-processing
str_replace('\\/', '/', json_encode("2011/7/11"));
Note that \/
is a valid way to represent /
in JSON.
$data_go = str_replace('\'','', $data_go);
it will remove all forwards slashes and will give you desired result..