note 99820 added to function.json-decode
| From: | Jestep at osu1 dot php dot net | Date: | Wed, 08 Sep 2010 20:26:36 +0000 |
| Subject: | note 99820 added to function.json-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172386@lists.php.net to get a copy of this message | ||
I had a JSON string with multiple commas in it without any quotes, which was causing the json_decode
to return false.
Once the double quotes were added, everything worked out fine.
A quick:
while(strpos($contents, ',,') !== false) {
$contents = str_replace(',,', ',"",', $contents);
}
solved the problem, and the function worked correctly. If you have tried everything and are still a
FALSE return, I suggest trying the JSON validator in another post.
----
Server IP: 74.208.45.212
Probable Submitter: 216.136.25.250 (proxied: 216.136.25.250)
----
Manual Page -- http://www.php.net/manual/en/function.json-decode.php
Edit -- https://master.php.net/note/edit/99820
Del: integrated -- https://master.php.net/note/delete/99820/integrated
Del: useless -- https://master.php.net/note/delete/99820/useless
Del: bad code -- https://master.php.net/note/delete/99820/bad+code
Del: spam -- https://master.php.net/note/delete/99820/spam
Del: non-english -- https://master.php.net/note/delete/99820/non-english
Del: in docs -- https://master.php.net/note/delete/99820/in+docs
Del: other reasons-- https://master.php.net/note/delete/99820
Reject -- https://master.php.net/note/reject/99820
Search -- https://master.php.net/manage/user-notes.php