Paste a JSON payload and get TypeScript types back, either interfaces or type aliases, with nested objects extracted into their own named types and an export toggle.
Paste any JSON and instantly generate TypeScript interfaces or type aliases. Handles nested objects, arrays, and nullable types.
export interface Root {
id: number;
name: string;
email: string;
isActive: boolean;
roles: string[];
profile: Profile;
metadata: null;
}
export interface Profile {
bio: string;
links: Links[];
}
export interface Links {
label: string;
url: string;
}The output is a starting point that needs one round of human editing, and knowing why helps. A generator infers types from a single sample, so a field that happens to be null in your example becomes null rather than string | null, an empty array becomes never[], and an optional field that is present in your sample is typed as required. Feed it the fullest example you have and then widen by hand.
For an API you do not control, generated types are a snapshot, not a contract. They will silently drift when the API changes. If the provider publishes an OpenAPI schema, generating from that instead gives you something that stays honest.