3 ms·
The real question is why doesn't Python have something like a class decorator`@json.interchangeable` that you can apply to a class -- maybe dataclasses only? --
by bobbylarrybobby 4y ago
The real question is why doesn't Python have something like a class decorator`@json.interchangeable` that you can apply to a class -- maybe dataclasses only? -- to have json (de)serialization be only three lines of code (or less).
- cochne 4y agoI implemented a shoddy version of this once (before accepting that pickles are worth it) only took like 100 LOC for serialization and deserialization.
- npage97 4y agoThere is dataclasses-json which does this https://pypi.org/project/dataclasses-json/ https://pypi.org/project/dataclasses-json/