Re: JsonSerializable New Interface method Proposal

From: Date: Mon, 13 Jul 2015 14:08:01 +0000
Subject: Re: JsonSerializable New Interface method Proposal
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-87143@lists.php.net to get a copy of this message
Hi, I like the general idea behind that proposal. I'm not sure how you would want to implement that however (please expand the rfc on that topic). Do you want to give the cast syntax a special meaning if used in connection with json_decode or add the general ability to cast a stdClass object (as returned by json_decode) to a specific user type or do you want to change json_decode to return a new class (extending stdclass) that can be casted in the way you want? The first two could be considered fundamental changes to the language, the third may include serious bc concerns. Wouldn't an additional function (maybe in addition to your proposed interface; example: json_decode_to(string $json, string $className, int $options)) solve the issue without changing the language? Regards, 2015-07-13 15:22 GMT+02:00 Dean Eigenmann <dean.eigenmann@icloud.com>: > Ive just opened a new RFC > https://wiki.php.net/rfc/jsonserializable > regarding Json to Object unserialization.

« previous php.internals (#87143) next »