JSON to TypeScript Interfaces
Generate TypeScript interfaces from a sample JSON payload, with nested types, optional properties inferred from arrays, and safe property names.
Runs on your device
Result
Results appear here after you select “Generate”.
What it does
Paste a real API response and get typed interfaces to start from. Arrays of objects are merged so keys missing from some items become optional.
How to use it
- Paste sample JSON.
- Name the root type.
- Generate and copy the interfaces into your project.
Example
The example fills in realistic values and runs the tool. Select Try an example above to see it.
When it helps
- Typing a third party API quickly.
- Documenting payload shapes.
- Starting a frontend model layer.
Questions
Are the types exact?
They describe the sample you pasted. A field that is a number in the sample but sometimes a string in production will need adjusting by hand.
How are null values typed?
As null. Widen them to the real type (for example string | null) once you know it.
More developer tools
See all 25- Chmod Calculator (Linux Permissions) Convert Linux file permissions between octal (755) and symbolic (rwxr-xr-x) notation and see exactly who can read, write and execute.
- YAML ⇄ JSON Converter Convert YAML to JSON and JSON to YAML for Kubernetes manifests, GitHub Actions, Docker Compose and config files, with clear parse errors.
- SQL Formatter Beautify messy SQL queries with consistent indentation and keyword case for MySQL, PostgreSQL, SQL Server, SQLite and more.
- CSS & JavaScript Minifier Minify JavaScript with Terser and CSS with a safe whitespace and comment remover, and see how many bytes and percent you save.
- CSS Gradient Generator Build linear and radial CSS gradients from up to five colours, preview them, and copy ready to use CSS for backgrounds and buttons.
- HTTP Status Code Lookup Look up what any HTTP status code means, from 200 OK and 301 redirects to 404, 429 and 503, with practical notes for debugging.
People also use
Browse all 200 tools- Savings Goal Calculator Find out how much to save each month to reach a goal by a target date, including interest on your savings, or how long a monthly amount will take. Personal finance
- Google SERP Snippet Preview Preview how a title and meta description may be truncated in Google desktop results, using an approximate pixel width model rather than plain character counts. SEO
- Countdown to a Date Count down the days, hours, minutes and seconds to any date, such as Christmas, an exam or a launch, and share the countdown as a link. Time & productivity
- Sleep Calculator Find the best time to go to bed or wake up so you finish complete 90-minute sleep cycles and wake up feeling less groggy. Health & fitness