JSON to TypeScript Interface Generator
Paste JSON on the left and get typed TypeScript interfaces on the right — nested objects, arrays and optional keys all inferred, live in your browser.
This json to typescript converter reads a sample document and writes matching interfaces for you, so you don’t hand-type field names and shapes. It walks nested objects into their own interfaces, types arrays by their elements, and marks a key optional when it’s missing from some records — the sort of work a json type generator should just do. Rename the root, then copy the result or download a types.ts file. Use it to generate typescript from json quickly, whether you’re typing an API response or a config blob.
How it works
- 1
Paste a JSON sample
Drop a representative response or object into the left pane. A realistic sample gives better types.
- 2
Read the interfaces
The right pane fills in as you type — every nested object becomes its own json to ts interface, with optional fields flagged.
- 3
Copy or download
Set the root interface name, then copy the code or save it as a types.ts file for your project.
Instant & 100% private — nothing is uploaded
Everything runs locally in your browser. Your code, text and files are processed on your own device and are never sent to a server — so there are no upload waits, no size limits from us, and nothing is ever stored or logged.
Frequently asked questions
- How does it decide which fields are optional?
- When you paste an array of objects, a key that appears in some elements but not others is marked with a “?”. A single object treats every key as present.
- Does it handle nested objects and arrays?
- Yes. Each nested object becomes its own named interface, and arrays are typed by their contents — string[], a merged object type, or a union when the elements differ.
- What happens with null or empty arrays?
- A null value is typed as null, and an empty array becomes unknown[] since there’s nothing to infer an element type from.
- Can I rename the generated types?
- Set the root name in the toolbar. Nested interfaces are named after their keys, singularised for arrays (a “users” array yields a User interface).
- Is my JSON uploaded anywhere?
- No. This json type generator runs entirely in your browser, so nothing you paste leaves the page.
More tools
More from the Hivly network
Free sister tools on our other sites.