Skip to main content

call_pydantic_serializer

No overview available.

def call_pydantic_serializer(
instance: BaseModel,
include_defaults: bool = True
) - > dict

Serializes a Pydantic model instance into a dictionary or JSON-compatible format. This function is used to convert complex data structures into primitive types for API responses or storage.

Parameters

NameTypeDescription
instanceBaseModelThe Pydantic model instance to be serialized into a dictionary.
include_defaultsbool = TrueWhether to include fields that have their default values in the output.

Returns

TypeDescription
dictA dictionary representation of the model instance containing only serialized data types.