note 103438 added to function.json-decode

From: Date: Wed, 13 Apr 2011 15:58:34 +0000
Subject: note 103438 added to function.json-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-178798@lists.php.net to get a copy of this message
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. <? print_r(json_decode(str_replace('\\', '\\\\', '{"name":"/\"}'))); ?> where /\ is the string which doesn't worked. ---- Server IP: 195.54.192.44 Probable Submitter: 127.0.0.1 ---- Manual Page -- http://www.php.net/manual/en/function.json-decode.php Edit -- https://master.php.net/note/edit/103438 Del: integrated -- https://master.php.net/note/delete/103438/integrated Del: useless -- https://master.php.net/note/delete/103438/useless Del: bad code -- https://master.php.net/note/delete/103438/bad+code Del: spam -- https://master.php.net/note/delete/103438/spam Del: non-english -- https://master.php.net/note/delete/103438/non-english Del: in docs -- https://master.php.net/note/delete/103438/in+docs Del: other reasons-- https://master.php.net/note/delete/103438 Reject -- https://master.php.net/note/reject/103438 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#178798) next »