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 bob.ippolito
Recipients Michael Smith2, Nathaniel Manista, bob.ippolito, rhettinger, serhiy.storchaka, zgoda.mobica
Date 2020-06-06.19:01:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1591470086.2.0.616084248582.issue34858@roundup.psfhosted.org>
In-reply-to
Content
I would certainly reconsider it at this point, I think a bona fide ABC *specific to JSON encoding* would be a good way to do it. simplejson has two ways to do this, the `for_json` parameter which will use a `for_json()` method on any object as the JSON representation if present, and the `namedtuple_as_object` parameter which will do the same for objects with an `_asdict()` method. As part of the standard library it might make more sense to rename `for_json()` to `__json__()` or similar.

It is a bit unfortunate that you can't guarantee round-trip on deserialization, but that has always been the case. To get round-tripping (without tagging everything that has been encoded in some way like pickle does), you really should be working with a schema of some kind.
History
Date User Action Args
2020-06-06 19:01:26bob.ippolitosetrecipients: + bob.ippolito, rhettinger, serhiy.storchaka, Nathaniel Manista, Michael Smith2, zgoda.mobica
2020-06-06 19:01:26bob.ippolitosetmessageid: <1591470086.2.0.616084248582.issue34858@roundup.psfhosted.org>
2020-06-06 19:01:26bob.ippolitolinkissue34858 messages
2020-06-06 19:01:26bob.ippolitocreate