Re: json_encode ignores protected/private class members

From: Date: Thu, 09 Oct 2008 13:58:02 +0000
Subject: Re: json_encode ignores protected/private class members
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-40895@lists.php.net to get a copy of this message
Stefan Walk wrote:
That would be unclean. If it's implemented in some way, json_encode should look for the implementation of some interface (JSONEncodable or something) providing encoding/decoding methods (similar to __sleep/__wakeup). Looking at our current JSON implementations, such an interface would be very very welcome. If at all possible something like JSONDecodable would be great as well, for restoring class members from json.
Ron

« previous php.internals (#40895) next »