note 99820 deleted from function.json-decode by googleguy
| From: | googleguy@php.net | Date: | Fri, 14 Jun 2013 10:03:45 +0000 |
| Subject: | note 99820 deleted from function.json-decode by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-195211@lists.php.net to get a copy of this message | ||
Note Submitter: Jestep
----
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.