note 114767 deleted from function.json-decode by salathe
| From: | salathe@php.net | Date: | Mon, 21 Sep 2020 15:00:24 +0000 |
| Subject: | note 114767 deleted from function.json-decode by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215419@lists.php.net to get a copy of this message | ||
Note Submitter: nsardo
----
Just a quick note, as I got caught with this:
The json that is input into json_decode MUST be well formed, such that key's are QUOTED. I
wasted time debugging, a$$suming that the following would be fine:
[{id:2, name:"Bob",phone:"555-123-4567"}]
It returned null, basically. I had to QUOTE the keys:
[{"id":2, "name":"Bob", "phone":"555-123-4567"}]
THEN, everything worked as it should.