There are special use-cases that each language supports; this document pertains to Python models.
In some cases you might want to use pydantic data validation and settings management using Python type hints for the models.
You can find an example of its use here
Using the preset PYTON_JSON_SERIALIZER
, you can generate serializeToJson
method to convert model instance to JSON and deserializeFromJson
method to convert JSON to model instance.
- Above preset doesn't unwrap properties of type
ConstrainedDictionaryModel
withserialilzationType = unwrap
- The serialized JSON object will have the same property names as defined in the model object.
Check out this example for a live demonstration.