JSON to TypeScript Generator
Paste a JSON sample on the left, get clean TypeScript interfaces on the right. Powered by quicktype — the same engine used by major language servers. No more hand-writing types for API responses.
How to use this tool
Paste a representative JSON sample into the input on the left. Use a sample that includes all the fields and nested shapes you want typed.
TypeScript interfaces appear on the right as the type is inferred. The first run may take a second while the type inference engine loads (it runs in your browser).
Copy the generated code into a .ts file. The default root type is named Root — rename it to match your domain (e.g. User, Order).
quicktype combines similar object shapes to avoid duplicate interfaces, infers string unions for low-cardinality fields, and produces idiomatic TypeScript with optional/readonly modifiers where appropriate.
Because the inference runs locally, you can safely paste internal API responses or fixtures containing real-looking data without leaking schema details.
Frequently asked questions
How does the type inference work?
We use quicktype, an open-source type inference engine. It analyzes your JSON sample, groups structurally similar objects, infers arrays vs singletons, and emits named interfaces with reasonable property types.
What if my sample is missing optional fields?
Type inference can only see what is in the sample. Fields absent from your sample will not appear in the generated type, and fields that are sometimes null become nullable. Use a rich, representative sample for best results.
Why does the first run take a moment?
The quicktype engine (~1MB) is loaded on demand to keep the rest of the site fast. Subsequent conversions are instant.
Can I generate types for other languages?
Yes — our main editor's Tools panel includes Go, Java, C#, Python, and Rust output via the same engine.
Is my JSON sent to a server?
No. quicktype runs entirely in your browser via WebAssembly-ready JavaScript. Your data stays on your device.