News for hackers. Stuff that matters.
Re:Don't Pickle Your Data by bobbylarrybobby on Thursday August 11, 2022 @09:25PM (#32433834)
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).
Re:Don't Pickle Your Data by npage97 on Thursday August 11, 2022 @11:03PM (#32434329)
There is dataclasses-json which does this

https://pypi.org/project/dataclasses-json/

Re:Don't Pickle Your Data by cochne on Thursday August 11, 2022 @10:03PM (#32434017)
I implemented a shoddy version of this once (before accepting that pickles are worth it) only took like 100 LOC for serialization and deserialization.