1 Feb
2018
1 Feb
'18
11:26 p.m.
On Thu, Feb 01, 2018 at 08:45:13PM +0000, Kiss, György wrote:
Hi!
Most of the classes (even if very simple like datetime.datetime) cannot be serialized to JSON by default.
Would it be a good idea for the default json.JSONEncoder to call the __json__ dunder method automatically if the object has one? I can't find anything about why this protocol or PEP doesn't exists yet.
See: http://bugs.python.org/issue27362 This has been discussed before: https://mail.python.org/pipermail/python-ideas/2010-July/007811.html https://mail.python.org/pipermail/python-ideas/2011-March/009644.html Please familiarise yourself with the objections and counter-arguments already discussed before trying to debate this again. -- Steve