Paste valid JSON into the input area on the left.
Set the root model name (defaults to 'Root') using the option field.
Choose the Pydantic version: v1 or v2.
Toggle field aliases to generate Field(alias=...) for JSON keys that differ from Python naming conventions.
Click Convert or press ⌘↵ (Mac) / Ctrl+Enter (Windows) to generate Pydantic models.
Copy the generated Python code or download it as a .py file.
Generates Pydantic v1 and v2 BaseModel classes from any JSON object or array.
Supports nested objects — creates separate named models for each nested structure.
Smart type inference: str, int, float, bool, None, List[T], Optional[T], and nested model types.
Optional Field(alias=...) for snake_case Python names that map to camelCase JSON keys.
Pydantic v2 mode uses model_config = ConfigDict(populate_by_name=True) for alias support.
Correct Optional[T] for nullable fields.
Works entirely in your browser — JSON never leaves your device.
Keyboard shortcut ⌘↵ for instant conversion.