JSON to TypeScript
Paste any JSON and get ready-to-use TypeScript interfaces in seconds. Nested objects get their own interfaces, array items are type-inferred and merged, and you control the root name, optional fields and the export keyword. Everything runs in your browser — your data never leaves this page.
How to use
- Paste or type your JSON into the input box (or press Load Sample to try it).
- Set the root interface name and choose whether fields are optional and exported.
- Press Generate TypeScript to see the interfaces.
- Use Copy to copy the result, or Download .ts to save it as a file.
Good to know
- Nested objects each get their own interface, named from their property path.
- Arrays of objects are merged: every item shape is combined into one inferred interface.
- A field missing from some array items is always marked optional, even with the toggle off.
- Empty arrays become
any[]and mixed-type fields become union types. - Invalid JSON shows a clear error with the exact position of the problem.