Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
bobbylarrybobby
· 4y ago · 0 comments
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).
Comments
[–]
npage97
4y ago
There is dataclasses-json which does this
https://pypi.org/project/dataclasses-json/
[–]
cochne
4y ago
I implemented a shoddy version of this once (before accepting that pickles are worth it) only took like 100 LOC for serialization and deserialization.