The JSON to TypeScript converter generates TypeScript interfaces from a sample JSON document. Paste an API response and get typed interfaces describing its shape, so you can drop them into your code and get autocomplete and compile-time checks instead of untyped any.
Generation happens in your browser with no upload, so you can safely turn a real production payload into types without it leaving your machine. It is free and requires no account.
It is for front-end and full-stack developers who consume JSON APIs and want accurate types fast, without hand-writing interfaces for every nested object.
Each nested object becomes its own named interface, and the parent references it by name. This produces clean, reusable types instead of one giant inline shape, matching how you would structure them by hand.
When the input is an array of objects that don't all share the same keys, optional detection marks the keys that are missing from some elements as optional with a ? modifier. This captures the real, sometimes-present shape of list data rather than assuming every field is always there.
Toggle whether interfaces are prefixed with export. Turn it on to drop the types straight into a module that other files import; turn it off for a local, self-contained snippet.
Types are inferred from the sample values: strings, numbers, booleans, arrays and nested objects. Because a single example can't show every case, an empty array becomes any[] and a field that is null in the sample can't reveal its real type — refine those by hand.
With optional detection on and an array of objects as input, any key that is absent from at least one element is marked optional with ?. A single object gives no evidence of optionality, so all its keys are treated as required.
The sample didn't carry enough information — for example an empty array or a null value can't reveal the element or field type. Provide a fuller example or adjust the generated type by hand.
Yes. Generation runs entirely in your browser, so the payload you paste is never uploaded.
Turn it on if you'll import the interfaces from other files; leave it off for a local or throwaway snippet.
Yes. Nested objects are extracted into separate named interfaces derived from their property names, so the output reads like types you'd write yourself.