[issue27362] json.dumps to check for obj.__json__ before raising TypeError

R. David Murray report at bugs.python.org
Wed Jun 22 18:28:29 EDT 2016


R. David Murray added the comment:

Pretty much any project that makes non-trivial use of json ends up implementing a jsonification protocol, usually by creating either a __json__ method or (more commonly, I think) a to_json method.

But, yeah, this is python-ideas material and would get into the stdlib only as an officially blessed protocol, in which case using __json__ would make sense.  So I'm going to close the issue pending a consensus on python-ideas.  If it gets accepted the issue can be reopened.

----------
nosy: +r.david.murray
resolution:  -> later
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27362>
_______________________________________


More information about the Python-bugs-list mailing list