This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients conqp, rhettinger
Date 2020-12-28.18:01:33
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
This core of this idea is plausible.  It is a common problem for people to want to teach a class how to convert itself to and from JSON.

Altering the API for dicts is a major step, so you would need to take this to python-ideas to start getting buy-in.   A much smaller API change would be to just teach the JSON module to recognize a __json__ method.

Presumably if a robust serialization solution is created, people will need a way to deserialize back into a named tuple, data class, or custom class.  Offhand, the only way I can think of to do this would be to add a field that could be recognized by json.load().  Some care would be needed to not create a pickle-like risk of arbitrary code execution.
Date User Action Args
2020-12-28 18:01:33rhettingersetrecipients: + rhettinger, conqp
2020-12-28 18:01:33rhettingersetmessageid: <>
2020-12-28 18:01:33rhettingerlinkissue42765 messages
2020-12-28 18:01:33rhettingercreate