3 ms·
In Python land, we use a library called marshmallow for mapping domain object attributes to JSON fields. In most cases, these mappings are a direct reflection o
by chestervonwinch 6y ago
In Python land, we use a library called marshmallow for mapping domain object attributes to JSON fields. In most cases, these mappings are a direct reflection of the associated domain objects, so the result is a bit verbose but still works nicely because you can easily version them as your model definition evolves over time.
I was under the impression that having an interface between models and JSON serialization was commonplace, given the popularity of marshmallow library in Python. Is this not the case in other languages and ecosystems?
- asdfsfkwqe 6y agoOne example, Enums. How do you parse them? by number? or by text values? or even both?
- AlphaSite 6y agoPydantic is another great library. Golang also has the builtin json struct deserialiser.