Is there a pre_dump decorator in pydantic, as in marshmallow

Viewed 206

in Pydantic, I need to transform the data when I load and dump the pydantic object. To change it on load,I am using the @root_validator decorator, however, I need to transform the data again, before dumping it. In Marshmallow I could do it with the @pre_dump or post_dump decorators, and I wonder if there is a similar decorator for pydantic?

(Or any other suggestions on how to transform the data during pydantic's load/dump processes)

0 Answers
Related