note 103438 deleted from function.json-decode by salathe

From: Date: Mon, 21 Sep 2020 14:59:49 +0000
Subject: note 103438 deleted from function.json-decode by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-215412@lists.php.net to get a copy of this message
Note Submitter: evengard at trioptimum dot com ---- There is a problem when passing to json_decode a string with the "\" symbol. It seems to identify it as an escape character and trying to follow it. So sometimes it leads to failed parsing. It seems that just replacing it with "\\" helps. <?php print_r(json_decode(str_replace('\\', '\\\\', '{"name":"/\"}'))); ?> where /\ is the string which doesn't worked.

« previous php.notes (#215412) next »