JSON to TypeScript
Generate TypeScript interfaces from sample JSON.
Conversion payloads stay in this browser tab and are never placed in page URLs - see how local processing works. Privacy-safe analytics record only the tool, outcome, and a coarse input-size bucket. Press Cmd/Ctrl + Enter to convert.
How to Generate TypeScript from JSON
Paste sample JSON and convert. The generator infers primitive types, arrays, nested interfaces, optional fields from multi-record samples, and safe property names.
Type System Notes
Output follows the object-type conventions of the TypeScript Handbook (https://www.typescriptlang.org/docs/handbook/2/objects.html). Types are inferred only from the supplied sample: optional markers reflect the records shown, heterogeneous arrays become unions, and ambiguous null-only fields are called out in comments for review.
Frequently Asked Questions
Does it support nested objects?
Yes. Nested objects become named interfaces referenced from the parent interface, and repeated identical shapes reuse one declaration.
Can I use array samples?
Yes. Records are merged across the whole array: fields missing from some records are marked optional with ?, and mixed arrays produce union item types with a comment flag.
What happens to unusual keys and null fields?
Keys that are not valid TypeScript identifiers, including Unicode keys, are quoted so the output still compiles. A field that is null in every sample is typed null and flagged, because its real type may be richer.