Ryan,

I think the usage of this won't support multidimensional arrays.

However in the decode function, 
You could specify

Foreach ($arr['permission'] as $permission) {
$this->permissions[] = (permission) json_decode($permission);
}

Sent from my iPhone

On 13 Jul 2015, at 17:03, Ryan Pallas <derokor...@gmail.com> wrote:

>> 
>>>> 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.

Reply via email to