note 95935 added to function.json-decode

From: Date: Fri, 29 Jan 2010 11:39:05 +0000
Subject: note 95935 added to function.json-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-165485@lists.php.net to get a copy of this message
Be aware, when decoding JSON strings, where an empty string is a key, this library replaces the empty string with "_empty_". So the following code gives an unexpected result: <?php var_dump(json_decode('{"":"arbitrary"}')); ?> The result is as follows: object(stdClass)#1 (1) { ["_empty_"]=> string(6) "arbitrary" } Any subsequent key named "_empty_" (or "" [the empty string] again) will overwrite the value. ---- Server IP: 212.124.37.9 Probable Submitter: 92.196.205.213 ---- Manual Page -- http://www.php.net/manual/en/function.json-decode.php Edit -- https://master.php.net/note/edit/95935 Del: integrated -- https://master.php.net/note/delete/95935/integrated Del: useless -- https://master.php.net/note/delete/95935/useless Del: bad code -- https://master.php.net/note/delete/95935/bad+code Del: spam -- https://master.php.net/note/delete/95935/spam Del: non-english -- https://master.php.net/note/delete/95935/non-english Del: in docs -- https://master.php.net/note/delete/95935/in+docs Del: other reasons-- https://master.php.net/note/delete/95935 Reject -- https://master.php.net/note/reject/95935 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#165485) next »