JSON to TypeScript
Turn any JSON into clean, nested TypeScript interfaces instantly.
Runs entirely in your browser — your input never leaves your deviceAbout this tool
Paste a JSON sample — typically an API response — and get back ready-to-use TypeScript interfaces. The generator walks the structure recursively, creating named interfaces for nested objects, inferring element types for arrays, and marking keys that don't appear in every array item as optional.
It saves you from hand-typing types for an unfamiliar payload. Conversion runs entirely in your browser, so internal API responses stay private.
Why use it
Nested interfaces
Walks the JSON recursively, naming interfaces for nested objects.
Smart arrays
Merges array-of-object keys and marks inconsistent ones optional.
Private
Type generation runs in your browser.
Common use cases
- Type an unfamiliar API response
- Bootstrap interfaces from sample data
- Avoid hand-writing types
- Turn a JSON fixture into TS
Frequently asked questions
How are arrays of objects handled?
The tool merges the keys of every object in the array into one interface, marking keys that are missing from some items as optional with a ? — so the type covers the whole array.
Does it infer optional fields?
Yes. Within an array of objects, any key not present in every element becomes optional. Null values are typed as null so you can refine them.
Is my JSON uploaded?
No. Parsing and type generation happen entirely in your browser; nothing is sent to a server.
What name do the interfaces get?
The root interface is named Root, and nested interfaces are named after their key (PascalCased). Rename them to taste after copying.