How to use
- Paste a JSON sample, or click Load sample.
- Set the name of the root type.
- Choose interfaces or type aliases.
- Copy or download the generated types.
Options explained
- Root type name
- Name of the top-level type, for example User or ApiResponse. Nested types are named after their keys — address becomes Address, and items in posts become Post.
- Use type instead of interface
- Generates type aliases (type User = { … }) instead of interfaces. Both work the same for plain data.
Examples
{"id": 1, "tags": ["a"], "owner": {"name": "Ada"}} becomes:
export interface Owner {
name: string;
}
export interface Root {
id: number;
tags: string[];
owner: Owner;
}
Frequently asked questions
How are arrays of objects handled?
All items are merged into one type. A key that appears in only some items becomes optional (key?), and a value that is sometimes null becomes a union such as string | null.
Why is a field typed as unknown?
The sample only contained null for it, so its real type cannot be inferred. Replace unknown with the correct type, or paste a sample where the field has a value.
Are integers and decimals different types?
Not in TypeScript — both become number. The Go, Rust and Python outputs do distinguish them.
Is my JSON uploaded?
No. The types are generated in your browser, so API responses with real data stay on your device.
Privacy
This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.