Skip to content

Serialising (to JSON) a custom datatype/structure #1615

Answered by schroeder-
chrisbeardy asked this question in Q&A
Discussion options

You must be logged in to vote

All no basic datatypes(int, float, str, ...) are based on Dataclasses. To serialize as json you need to use a custom encoder see this stackoverflow for example:
https://stackoverflow.com/questions/51286748/make-the-python-json-encoder-support-pythons-new-dataclasses

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@chrisbeardy
Comment options

Comment options

You must be logged in to vote
1 reply
@chrisbeardy
Comment options

Answer selected by chrisbeardy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants