Skip to main content

pydantic_encoder

Encodes objects into JSON-compatible formats by handling Pydantic models, dataclasses, and types with registered encoders. This function is deprecated and issues a warning, recommending the use of pydantic_core.to_jsonable_python instead.

def pydantic_encoder(
obj: Any
) - > Any

Converts Pydantic models, dataclasses, and other supported types into JSON-serializable Python objects. This function is deprecated and callers should use pydantic_core.to_jsonable_python instead.

Parameters

NameTypeDescription
objAnyThe object to be encoded into a JSON-serializable format.

Returns

TypeDescription
AnyA JSON-compatible representation of the input object, such as a dictionary or a primitive type.