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 _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/