JSON → TypeScript
Paste a JSON sample, get TypeScript interfaces inferred from its structure. Optional union of all values' types per field.
100% in your browser. Files never uploaded.
TypeScript
export interface Root {
id: number;
name: string;
tags: string[];
address: Address;
}
export interface Address {
city: string;
country: string;
}
How to use
- 1Paste JSONA representative sample, ideally with all the optional fields populated.
- 2Set the root type nameDefaults to "Root".
- 3Copy the interfacesDrop straight into your codebase.
FAQ
How are nested objects named?
PascalCase of the parent key. An array key is singularized: "users" → User. If two objects collide on a name, the second gets a numeric suffix.
Are array element types unioned?
Yes. ["a", 1] becomes Array<string | number>. Heterogeneous arrays don't silently lose info.