JSON to TypeScript Interface
Infer TypeScript interfaces from any JSON object, with nested objects and array element types. Runs in your browser.
Pure browser JavaScript — no external libraries.
How to use this tool
- Paste a JSON object (or array), or upload a .json file.
- Set the root interface name.
- Click Generate interface, then Copy or Download the .ts file.
Infer TypeScript interfaces from any JSON object, with nested objects and array element types. Runs in your browser.
Frequently asked questions
- How are nested objects handled?
- Each nested object becomes its own named interface (derived from its key), referenced from the parent.
- What about mixed array types?
- Array element types are unioned, e.g. (string | number)[]. Empty arrays become any[].