Skip to content
masterclass Buddy

Pydantic · Class

TypeAdapter

TypeAdapter lets you validate, serialize, and generate JSON Schema for a Python type without creating a BaseModel. It works with types such as collections, dataclasses, primitive types, and TypedDicts.

Last updated

Syntax

TypeAdapter(type, config=None)
adapter.validate_python(object)
adapter.validate_json(data)
adapter.dump_python(instance)
adapter.dump_json(instance)
adapter.json_schema()

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • TypeAdapter.validate_python
  • TypeAdapter.validate_json
  • TypeAdapter.dump_python
  • TypeAdapter.dump_json
  • TypeAdapter.json_schema
  • TypeAdapter.json_schemas
  • TypeAdapter.rebuild
  • ValidationError

Source: Type Adapter | Pydantic Docs. Checked 2026-11-03.