Input (JSON)
{
"id": 1,
"name": "Ada",
"active": true,
"roles": ["admin"]
}The JSON → TypeScript tool inspects a JSON sample and generates matching TypeScript interfaces, inferring field types from the values it sees. Strings become string, numbers become number, booleans become boolean, arrays become typed arrays, and nested objects become their own interfaces. This saves the tedious, error-prone work of hand-writing types for API responses and gives you compile-time safety when consuming JSON data.
JSON is an untyped, text-based data format, while TypeScript adds a static type layer over JavaScript using interfaces and type aliases to describe the shape of data. An interface declares the expected keys and their types, letting the compiler catch mistakes like missing fields or wrong value types. Generating interfaces from a real JSON payload bridges the two so your code can treat dynamic data with confidence.
The main file is the entry point for each run.
Use the Input panel to pipe standard input to your program when it needs data.
Run sends your code to a fresh hosted runtime and streams the result into the output panel.
Your draft stays in this browser, and Share creates a separate snapshot link.
{
"id": 1,
"name": "Ada",
"active": true,
"roles": ["admin"]
}interface Root {
id: number;
name: string;
active: boolean;
roles: string[];
}{
"user": {
"id": 1,
"email": "[email protected]"
}
}interface User {
id: number;
email: string;
}
interface Root {
user: User;
}{
"items": [
{ "id": 1, "qty": 2 }
]
}interface Item {
id: number;
qty: number;
}
interface Root {
items: Item[];
}{
"price": 9.99,
"tags": ["a", "b"],
"note": null
}interface Root {
price: number;
tags: string[];
note: null;
}{
"order": {
"id": 7,
"customer": {
"name": "Ada",
"vip": true
}
}
}interface Customer {
name: string;
vip: boolean;
}
interface Order {
id: number;
customer: Customer;
}
interface Root {
order: Order;
}{
"count": 3,
"ratios": [0.5, 1.5],
"items": []
}interface Root {
count: number;
ratios: number[];
items: any[];
}[
{ "id": 1, "name": "Ada" },
{ "id": 2, "name": "Linus" }
]interface RootItem {
id: number;
name: string;
}
type Root = RootItem[];The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Paste a JSON sample and get matching TypeScript interfaces generated automatically.
Field types are inferred from the actual values in your payload.
Saves the tedious, error-prone work of hand-writing types for API responses.
Strings infer string, numbers infer number, booleans infer boolean.
Arrays become typed arrays based on their element values.
Nested objects are extracted into their own named interfaces.
Adding compile-time safety when consuming dynamic JSON data.
Bootstrapping types from a real response before writing client code.
Inference runs entirely in your browser — your sample JSON is never uploaded.
Paste real API responses without exposing their contents.
Output
TypeScript types