JSON to TypeScript — interfaces from a sample
Paste sample JSON and get TypeScript interfaces inferred from its structure. It generates in your browser (0 uploads, works offline).
How to use it
- Paste your input into the left pane.
- Choose any options above the panes.
- The result updates live on the right — Copy or Download it.
FAQ
How do I generate TypeScript interfaces from JSON for free?
Paste a JSON sample and matching TypeScript interfaces appear instantly in your browser with no upload — strings, numbers, booleans, arrays and nested objects are typed automatically, with nested objects extracted into their own named interfaces.
How are nested objects handled?
Each nested object becomes its own interface, named from its key, and referenced from the parent — the idiomatic way to type nested JSON in TypeScript rather than one giant inline type.
Is my JSON uploaded?
No. The inference runs locally and nothing is stored; it works offline.
What about optional or union fields?
Types are inferred from the single sample you provide, so a field is typed by what is present. Optional and union types across multiple samples are a future enhancement.
Limits
Infers from one sample; it cannot know which fields are optional or nullable across records. Empty arrays type as unknown[].
Related
The JSON schema generator produces a JSON Schema; the JSON formatter validates JSON.
Bookmark this page (Ctrl+D, or ⌘D on Mac) or install the app — it works offline the next time you need it.