JSON to TypeScript Converter
Paste any JSON and get clean TypeScript interfaces — nested types, unions, and nullables inferred automatically.
How it works
Paste any JSON value — an object, an array, or a primitive. The converter walks the structure recursively: nested objects become named interfaces ("address" → interface Address), arrays of objects are merged so optional fields and union types are detected across all samples, and keys that aren't valid identifiers are safely quoted. Choose between export interface, plain interface, or export type output.
Typing rules
Arrays become elementType[]; mixed arrays become unions like (string | number)[]; null values produce | null unions; empty arrays fall back to unknown[]. Paste an array of sample responses and any key missing from some samples is marked optional with ? — the closest a generator can get to a real schema from examples alone.
FAQ
How are nested JSON objects handled?
interface Address. Arrays of objects are merged into one interface.How are arrays, nulls, and mixed types handled?
elementType[]; mixed arrays become unions like (string | number)[]; null values add a | null union; empty arrays fall back to unknown[]. Every union is deduplicated automatically.How do I get optional (?) fields?
?. A single object produces all-required fields.