Add sample JSON
Paste a JSON object or array, or upload a valid .json file up to 10 MB.
Turn sample JSON into structured Python dataclasses or Pydantic models with nested classes, accurate type hints, optional fields, aliases, and import-ready code.
Generate strongly typed models from representative JSON in three simple steps.
Paste a JSON object or array, or upload a valid .json file up to 10 MB.
Select dataclasses or Pydantic, set the root class name, and control optional, null, and naming behavior.
Review the inferred definitions, copy them, or download a ready-to-edit .py file.
The converter examines every object in a top-level array, combines available keys, identifies fields missing from some records, and produces unions where values use different Python types.
Nested objects become named classes, object arrays receive typed item models, empty arrays use list[Any], and null values can become explicit None unions. Invalid keys are converted into safe attributes, with Pydantic aliases preserving the original JSON names.
Designed for API responses, SDK models, frontend data contracts, fixtures, migrations, and rapid prototyping.
Your JSON is analyzed locally and is never submitted to the website server.
All sampled array items contribute to property and union inference instead of only the first row.
Generated classes include required imports and use Any only when the sample cannot support a narrower type.
Important details about inference and generated Python definitions.
Yes. Select standard-library @dataclass output or Pydantic BaseModel classes before generating.
The converter examines all sampled objects, combines their keys, marks missing properties as optional, and creates a named item model.
When null preservation is enabled, JSON null becomes None in a Python union, such as str | None.
Keys are converted to valid Python attribute names. Pydantic output adds Field(alias=...) when the generated name differs.
No. Parsing, inference, preview, copying, and download creation happen locally in your browser.
Yes. The classes describe the supplied sample, so compare them with the complete API schema and validation rules before production use.