parse_obj_as
Parses an object into a specified type using a Pydantic TypeAdapter, though it is now deprecated in favor of pydantic.TypeAdapter.validate_python.
def parse_obj_as(
type_: type[T],
obj: Any,
type_name: NameFactory | None = null
) - > T
Parses and validates an arbitrary object against a specified Pydantic-compatible type. Note: This function is deprecated; use pydantic.TypeAdapter.validate_python instead.
Parameters
| Name | Type | Description |
|---|---|---|
| type_ | type[T] | The target Pydantic-compatible type or annotation to validate the object against |
| obj | Any | The raw data or object to be parsed and validated |
| type_name | `NameFactory | None` = null |
Returns
| Type | Description |
|---|---|
T | The input object validated and coerced into the specified type T |