JSON to TypeScript Interface Generator
Paste any JSON object and instantly get export-ready TypeScript interface definitions. Handles nested objects, arrays, null values, and deeply nested structures. Runs entirely in your browser — your data never leaves your device.
About this tool
Converts any JSON object into typed TypeScript interfaces. Nested objects produce separate named interfaces, arrays infer their element type, and null values map to null. All interfaces are export-ready and ordered so child types appear before their parents. Runs entirely in your browser — nothing is sent to a server.
Features
Nested objects
Each nested object generates a separate named interface automatically
Array inference
Arrays are typed correctly — object arrays generate item interfaces
Null support
JSON null values are preserved as TypeScript null types
Custom root name
Set any name for the root interface — not just "Root"
Dependency order
Child interfaces always appear before the parents that reference them
Browser-only
Zero network requests — your JSON never leaves your device
How to use
- 1
Paste JSON
Copy any JSON object or array into the input field on the left.
- 2
Set root name
Optionally rename the root interface from "Root" to something meaningful like "User" or "ApiResponse".
- 3
Generate
Click Generate Interfaces. Nested objects will produce their own interfaces, ordered by dependency.
- 4
Copy & paste
Copy the output and paste it directly into your TypeScript project file.
Frequently asked questions
Can I generate interfaces from a JSON array?
Yes. Paste a JSON array and the tool will use the first element to infer the interface shape. For example, pasting an array of user objects will generate a User interface based on the first item.
How do I mark fields as optional?
The tool generates all fields as required. To mark a field as optional, add a ? after the field name in the output — for example: email?: string;
Does it support deeply nested JSON?
Yes. The tool recursively processes objects at any depth, generating one interface per unique object shape with names that reflect the nesting path.
Why does the tool only look at the first array element?
JSON has no schema — arrays can contain mixed types. The tool uses the first element as a representative sample. If your array contains objects with varying shapes, review the generated interface and add union types or optional fields as needed.