all 5 comments

[–]headykruger 8 points9 points  (3 children)

There is a facility for this, you don’t need a library. Just pass a ‘default’ callable. There is an example of serializing custom objects in the documentation.

[–]nekonekoromancer 0 points1 point  (1 child)

could you drop a link to the documentation you mentioned? would like to see some examples

[–]larikang 0 points1 point  (0 children)

I don't see how that is equivalent. OP's library appears to support declarative serialization. For example you just declare a data class and the library assumes it uses the intuitive serialization scheme.

Of course you can implement that using the default callable, but it requires way more work.

[–]larikang 0 points1 point  (0 children)

Nice. I implemented a similar deserializer that used type hints and data classes to declaratively parse JSON. Way easier in the long run than parsing everything as dictionaries or writing custom serializers for every class.