Paste JSON to generate TypeScript interfaces
Help
About this tool
Paste any JSON object and get ready-to-use TypeScript interfaces or type aliases. Nested objects become their own interfaces, object arrays merge all their keys, and optional fields are inferred automatically — all locally in your browser.
How to use
- Paste your JSON into the input box.
- Set the root type name and choose whether to add export.
- Copy the generated TypeScript definitions.
How are arrays with mixed element types handled?
Elements are merged into a union, so [1, "a"] becomes (number | string)[]. Arrays of objects merge every element's keys, and keys missing from some elements become optional (key?:).
Why does an empty array become unknown[]?
An empty array carries no element to inspect, so the element type cannot be inferred and is emitted as unknown[]. Replace it with the concrete element type you expect.
How is null handled?
A null value marks that field optional (key?) and keeps null in its type, e.g. name?: string | null.
Is my JSON uploaded anywhere?
No. Parsing and type generation run entirely in your browser.