Pydantic · Module
model_validate_json
Pydantic models describe fields and their types, then validate input against those declarations. They support Python objects, JSON data, and string-valued dictionaries, and they provide methods for serialization and schema inspection.
Last updated
Syntax
class User(BaseModel):
id: int
name: str = "John Doe"
User.model_validate(data)
User.model_validate_json(json_data)
User.model_validate_strings(data)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
BaseModelmodel_validatemodel_validate_jsonmodel_validate_stringsmodel_dumpmodel_dump_jsonmodel_fieldsmodel_fields_set