All demos
JSON → TypeScript
Paste an API response, get interfaces you can actually keep.
valid JSON
TypeScript4 interfaces
interface Address {
city: string;
zip: string;
}
interface Customer {
name: string;
email: string;
address: Address;
}
interface Item {
sku: string;
qty: number;
price: number;
discount?: number;
}
interface Response {
id: string;
createdAt: string;
paid: boolean;
total: number;
refundedAt: null;
customer: Customer;
items: Item[];
}How it works
The JSON is parsed, walked once, and every value is reduced to a type. Objects get merged so optional keys are marked with a question mark, arrays are unified into one item type, and a value that is sometimes null produces a union with null. Nothing is inferred from the key name — only from the data, which is why the result stays honest.
Built withTypeScript · Vue 3