JSON to TypeScript Interface Generator
Paste JSON and generate TypeScript interfaces or type aliases with nested objects, arrays, null values, optional fields, readonly properties, and semicolons.
Options
What is a JSON to TypeScript generator?
A JSON to TypeScript generator turns sample JSON data into TypeScript interfaces or type aliases that describe the shape of the object.
It helps when consuming API responses, documenting payloads, creating front-end models, or quickly drafting types before refining them in a codebase.
How to use the JSON to TypeScript generator
- Paste a JSON object, array, or API response into the input editor.
- Choose a root type name and whether to generate interfaces or type aliases.
- Enable readonly, optional fields, or semicolons if they match your project style.
- Click Generate types and copy the TypeScript output.
Tips
- Use representative JSON samples so optional fields and array item shapes are inferred more accurately.
- Fields missing from some objects in an array can be marked optional.
- Null values are represented as unions such as string | null.
- Review generated types before committing them to production code.
Related tools
You may also find these tools useful.
JSON Formatter
Format and minify JSON instantly.
Data & Format
›
JSON Schema Validator / Generator
Generate JSON Schema from JSON and validate JSON against schema.
Data & Format
›
JSONPath Tester
Run JSONPath expressions against JSON and inspect matching values and paths.
Data & Format
›
JSON Escape / Unescape
Escape text for JSON strings and unescape JSON string sequences.
Data & Format
›
OpenAPI / Swagger Validator & Explorer
Validate OpenAPI YAML or JSON and explore endpoints, schemas, servers, security, and responses.
Data & Format
›
JSON to TypeScript Generator FAQ
Does it support nested objects?
Yes. Nested objects are emitted as separate named interfaces or type aliases.
How are arrays handled?
Arrays are inferred from their items. Arrays of objects are merged into a shared item type, with missing fields handled as optional or undefined.
Can it generate type aliases instead of interfaces?
Yes. Use the declaration style control to switch between interfaces and type aliases.
Is my JSON uploaded?
No. Type generation runs in your browser.