JSON to TypeScript
Generate TypeScript interfaces from any JSON — nested objects, arrays and unions, ready to paste into your project.
root must be a JSON object
This tool runs entirely in your browser. Your data never leaves your device — it is not uploaded to any server.
How to use
- 1Paste your JSON (an API response works best).
- 2Set the root interface name if you want something other than Root.
- 3Copy the generated interfaces into your project.
JSON to TypeScript
Paste a JSON response and get typed interfaces instantly: nested objects become named interfaces, arrays of objects merge into one shape, mixed arrays become unions. Root name is configurable.
Built for API work — paste an endpoint response, copy the types, and let the compiler catch shape changes for you.
Frequently asked questions
How are arrays handled?
Arrays of objects merge every element's keys into one interface (missing keys would be a type error at runtime anyway). Mixed-type arrays become a union type like string | number. Empty arrays degrade to unknown[].
Are all fields required?
Yes — a single sample can't prove optionality, so everything is required. Mark fields optional yourself where your API allows null or missing keys.
Related tools
JSON Formatter
Format and beautify messy JSON online — 2 spaces, 4 spaces or tabs, with instant validation and precise error locations. 100% in your browser.
All tools →
JSON Validator
Validate JSON instantly with precise error line and column. Catch missing commas, unquoted keys, trailing commas and bad escapes before they break your app.
All tools →
JSON Diff
Compare two JSON documents path by path — added, removed and changed keys with before/after values, all locally.
All tools →
JSON Path Query
Extract any value from JSON with a path like $.user.name or $.items[0].id — instant, forgiving, no jq syntax to learn.
All tools →
JSON ⇄ YAML Converter
Convert JSON to YAML and back — config-file ready, with a swap-to-continue workflow and precise error messages.
All tools →
Embed this tool
Put this tool on your own site with one line — it runs entirely in the visitor's browser.
<iframe src="https://zoyku.com/en/tools/json-to-typescript?embed=1" width="100%" height="640" style="border:0;border-radius:16px" title="Zoyku — json-to-typescript" loading="lazy"></iframe>