JSON → TypeScript
Generate TypeScript interfaces from JSON samples.
—About the JSON → TypeScript
Paste a JSON sample and receive ready-to-use TypeScript interfaces that match its shape. Nested objects become their own named interfaces, arrays become typed arrays, and identical object shapes are deduplicated instead of repeated. Set the root interface name and optionally prefix every declaration with export.
How to use the JSON → TypeScript
- Paste a JSON sample into the input area.
- Type a name for the root interface — it becomes the top-level type.
- Tick Export interfaces if the types will live in their own module.
- Copy the generated TypeScript from the output box, including the root type comment.
JSON → TypeScript FAQ
How are nested objects handled?
Each nested object becomes a separate interface named after its key, converted to PascalCase; repeated identical shapes are detected and reused rather than declared twice.
What if my array is empty?
An empty array is typed as unknown[], since no elements exist to infer a type from — fill in a sample element for a precise result.
Are null and mixed types supported?
Null fields map to the null type, and arrays containing different element types produce a union such as (string | number)[].