Can pydantic do polymorphic JSON serialization based on a field like _type?

51 Views Asked by At

JDK Jackson has JsonSubTypes which can be based on a field like _type or @type or type etc. In our case we are using _operation. This field is absent from the fields of the deserialized object as it represents the type itself.

Is this possible with pydantic, and how?

0

There are 0 best solutions below