JSON to TypeScript
Convert JSON to TypeScript interfaces
Paste a JSON response and get typed TypeScript interfaces you can drop straight into your code. Nested objects become their own named interfaces.
How to use it
- Paste your JSON into the editor (for example, an API response).
- Open Tools → Generate types and choose TypeScript.
- Click Generate and copy the interfaces.
Example
{
"id": 42,
"name": "Ada Lovelace",
"active": true,
"roles": ["admin", "editor"],
"address": { "city": "London", "zip": "N1 9GU" }
}export interface RootObject {
id: number;
name: string;
active: boolean;
roles: string[];
address: Address;
}
export interface Address {
city: string;
zip: string;
}Features
Nested interfaces
Each nested object gets its own interface, named after its key.
Arrays typed
Arrays of primitives become string[], number[] and so on; arrays of objects get their own interface.
10 languages
TypeScript, Zod, Dart, Kotlin, Swift, Go, Rust, Python, Java and C#.
Copy in one click
Copy the generated code straight to your clipboard.
Frequently asked questions
How are nested objects handled?
Every nested object becomes a separate exported interface, and the parent property references it by name.
Can I generate a Zod schema instead?
Yes. Pick Zod Schema from the language list to get a Zod object schema for runtime validation.
How are array item types decided?
From the first item in the array. If items have different shapes, review the generated type and adjust it.
Is my JSON sent to a server?
No. Code generation runs entirely in your browser.