note 84267 added to function.json-decode
| From: | ganswijk at xs4all dot nl | Date: | Mon, 07 Jul 2008 02:42:16 +0000 |
| Subject: | note 84267 added to function.json-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-141220@lists.php.net to get a copy of this message | ||
It was quite hard to figure out the allowed Javascript formats. Some extra remarks:
json_decode() doesn't seem to allow single quotes:
<?php
print_r(json_decode('[0,{"a":"a","b":"b"},2,3]'));
//works
print_r(json_decode("[0,{'a':'a','b':'b'},2,3]"));
//doesn't work
?>
json_decode() doesn't allow an extra comma in a list of entries:
<?php
print_r(json_decode('[0,1 ]')); //works
print_r(json_decode('[0,1,]')); //doesn't work
?>
(I like to write a comma behind every entry when the entries are spread over several lines.)
json_decode() does allow linefeeds in the data!
?>
----
Server IP: 69.147.83.197
Probable Submitter: 82.95.148.42
----
Manual Page -- http://www.php.net/manual/en/function.json-decode.php
Edit -- https://master.php.net/note/edit/84267
Del: integrated -- https://master.php.net/note/delete/84267/integrated
Del: useless -- https://master.php.net/note/delete/84267/useless
Del: bad code -- https://master.php.net/note/delete/84267/bad+code
Del: spam -- https://master.php.net/note/delete/84267/spam
Del: non-english -- https://master.php.net/note/delete/84267/non-english
Del: in docs -- https://master.php.net/note/delete/84267/in+docs
Del: other reasons-- https://master.php.net/note/delete/84267
Reject -- https://master.php.net/note/reject/84267
Search -- https://master.php.net/manage/user-notes.php