JSON to TypeScript
Paste JSON and get ready-to-use TypeScript interfaces: nested objects become interfaces, arrays infer element types, keys are PascalCased, invalid keys quoted. Instant and offline.
Inference rules
Every JSON object becomes an interface named after its key (PascalCased); arrays sample their elements and emit element-type unions or …[]; null becomes the null type; numeric keys or keys with symbols are emitted as quoted string keys. Structures deeper than 12 levels collapse to unknown. Reused interface names reference the first definition — the output is deterministic for the same input.
How to use JSON to TypeScript
Drop a representative JSON payload — API response, config sample or fixture — into the input, and the tool infers an interface per object level: nested types get readable names, optional fields are marked, literal values become unions. Toggle the strictness options to decide how nulls and missing properties are treated.
Arrays of objects merge into one element interface from the observed shapes, so you can paste a handful of heterogeneous rows and still get a single accurate type. Copy the output straight into your project, then regenerate from a newer sample whenever the API evolves.
Frequently asked questions
What does the generated TypeScript look like?
The tool infers an interface or type per object level, marks optional fields, unions literal values and nests named types — instead of dumping everything into a huge any.
How are null and missing fields handled?
A property that appears with null in some records but is absent in others becomes a union with null or an optional field, depending on the strictness option you pick.
Can it handle arrays of objects?
Yes. Arrays of objects produce element interfaces merged from the observed shapes, so heterogeneous rows still yield one accurate, readable type.
Is the output production ready?
The types are deterministic and paste-ready for most codebases. For large APIs, generate from the smallest representative sample that covers every field you actually use.