How to Convert JSON to TypeScript Types, JSON Schema or Python
Turn a sample JSON response into TypeScript interfaces, a JSON Schema or a Python dataclass in your browser. Learn what to review afterwards.
Start from a sample
Copy a real JSON response from your API or a file. A single representative example is enough to get a working first draft of a type or schema.
Generate the output
Open the JSON to Schema tool and paste the JSON, then pick TypeScript, JSON Schema or Python. TypeScript output creates a separate interface for each nested object. JSON Schema output is draft-07. Python output is a single dataclass. Copy the result with one click. The conversion runs in your browser, so your data is not uploaded.
What to review
The tool works from one sample. For an array it uses the first item, so fields that only appear in later items are missed. Every key is treated as required, and null values become any in TypeScript, so mark optional fields and tighten types by hand.
Key names and nesting
In the TypeScript output, keys with spaces or hyphens are written without quotes, so rename or quote them before using the types. In the Python output, nested objects are typed as plain dict instead of their own class.
Más del blog
¿Qué es Becoderr? Más de 120 herramientas online gratis en un solo lugar
Becoderr es una colección gratuita de más de 145 herramientas online para PDF, imágenes, JSON, texto, desarrolladores y tareas diarias: privada, rápida y sin registro.
Cómo comprimir imágenes sin perder calidad
Reduce el tamaño de tus imágenes hasta un 90% manteniéndolas nítidas. Guía rápida para comprimir JPG y PNG en línea, gratis y privado.
Cómo convertir un PDF a un documento de Word editable
Convierte cualquier PDF en un .docx editable que puedes modificar en Microsoft Word, gratis y sin registro.