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.
Frequently Asked Questions (FAQ)
How do I convert JSON to TypeScript with this tool?
Paste your JSON in the input box, set the root interface name and options, then press Generate - nested objects and arrays are converted to interfaces automatically.
Does it handle arrays and nested objects?
Yes - array element shapes are merged into one inferred type and nested objects get their own interfaces with generated names.
What generation options can I set?
The root interface name, marking fields optional with ?, and adding the export keyword.
Is my JSON uploaded anywhere?
No. The generator works fully in your browser, and nothing you paste is sent to any server.