29 Jul
2010
29 Jul
'10
6:40 a.m.
On Thu, Jul 29, 2010 at 01:35:41PM +0200, Tarek Ziad? wrote:
What about adding in the json package the ability for an object to provide a different object to serialize ? This would be useful to translate a class into a structure that can be passed to json.dumps
So, it __json__ is provided, its used for serialization instead of the object itself:
Also there must be a deserialization hook. Pickle uses __setstate__, and pickle stores the name of the class to call __setstate__ upon. Oleg. -- Oleg Broytman http://phd.pp.ru/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.