Message370844
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. |
|
Date |
User |
Action |
Args |
2020-06-06 19:01:26 | bob.ippolito | set | recipients:
+ bob.ippolito, rhettinger, serhiy.storchaka, Nathaniel Manista, Michael Smith2, zgoda.mobica |
2020-06-06 19:01:26 | bob.ippolito | set | messageid: <1591470086.2.0.616084248582.issue34858@roundup.psfhosted.org> |
2020-06-06 19:01:26 | bob.ippolito | link | issue34858 messages |
2020-06-06 19:01:26 | bob.ippolito | create | |
|