API & Schemas • Type Codegen

JSON / JSON Schema to TypeScript & Pydantic v2 Generator

Convert raw API JSON payloads or Draft-07/2020-12 JSON Schema objects directly into TypeScript interfaces and Python Pydantic v2 BaseModel classes offline.

Input & Options Local JS Execution
Automatically detects JSON Schema ($schema / properties) vs. concrete sample JSON objects/arrays.
PascalCase root symbol name (e.g. InferenceJob, WebhookEvent).
Parsed Output & Diagnostics Ready
Status
...

Type Mapping Reference

JSON TypeTypeScriptPython Pydantic v2
stringstringstr
integer / numbernumberint / float
booleanbooleanbool
array of TT[]list[T]
null / optionalT | nullT | None = None

Parser Methodology & Privacy Guarantees

Walks parsed JSON ASTs or JSON Schema property maps recursively, extracts nested child objects into deduplicated PascalCase types, distinguishes integers vs floats for Python typing, and respects `required` schema arrays.

  • Detects JSON Schema objects via `$schema` or `type: 'object' + properties`.
  • Generates nested interfaces/BaseModels bottom-up so Python forward references aren't needed.
  • Sanitizes Python reserved keywords or hyphenated keys using `Field(alias=...)`.

Scope & limitations: Complex polymorphic `oneOf` / `$ref` external schema files should be bundled into a single JSON file before pasting.

Frequently Asked Questions

Does it use modern Python 3.10+ / Pydantic v2 syntax?
Yes. Generated Python models use BaseModel with built-in list[...] and X | None = None union syntax cleanly compatible with Python 3.10-3.13.
How are hyphenated keys handled in Python models?
Keys containing hyphens or spaces (like content-type) are converted to snake_case Python attributes with Field(alias='content-type').
Can I download generated types directly?
Yes, click Download File in the code output header to save .ts or .py definitions directly from your browser.

Related Developer Parsers

Every parser on DevParse runs 100% inside your browser with zero backend telemetry, zero file uploads, and zero cookie banners. Support development via Fourthwall or sponsor a clean developer slot.