I'm encoding it like so..
json_encode($array_list, JSON_UNESCAPED_SLASHES)
Ex: \n turns into \\n, \r\n turns into \\r\\n
But, it's still escaping the slashes! What's wrong and how to fix it? Thanks.
I think it is because of single and double quotes
, see the examples
$arr = array("\n\r");
echo json_encode($arr,JSON_UNESCAPED_SLASHES); // ["\n\r"]
$arr = array('\n\r');
echo json_encode($arr,JSON_UNESCAPED_SLASHES); //["\\n\\r"]
working example http://codepad.viper-7.com/LvWMhq
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With