Re: JSON inclusion in core
| From: | Mike Naberezny | Date: | Mon, 23 Jan 2006 17:51:28 +0000 |
| Subject: | Re: JSON inclusion in core | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-21655@lists.php.net to get a copy of this message | ||
Bart de Boer wrote:
Maybe introduce an optional second argument "decodetype" to json_decode() where you could pass on a constant like JSON_ARRAY or JSON_OBJECT? For example: $assoc_array = json_decode($json_string, JSON_ARRAY);I'm not saying this is a bad idea but is it really necessary? It seems to just add extra complexity. If json_decode() returns an associative array then you can cast easily enough: $obj = (object)json_decode($jsonSerialized); Mike$object = json_decode($json_string, JSON_OBJECT);