Re: JsonSerializable New Interface method Proposal
| From: | Ryan Pallas | Date: | Mon, 13 Jul 2015 15:03:40 +0000 |
| Subject: | Re: JsonSerializable New Interface method Proposal | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-87148@lists.php.net to get a copy of this message | ||
>
>
> Ive just opened a new RFC
> https://wiki.php.net/rfc/jsonserializable
>
> regarding Json to Object unserialization.
>
> I like the idea, but how do you handle complex json notations, that may
contain arrays of objects? Say:
{
"id": 123
"type": "user",
"name": "derokorian"
"permissions": [{
"id": 1,
"value": "create"
},{
"id": 2,
"value": "edit"
}]
}
Would this new function give me objects of type Permission in the
permissions array, or would this solution only be a single level deep and
therefore return an array of StdClass? I see no way to be able to tell this
to the decoder in the User class because php does not support typed arrays.