One document, or several samples as JSON Lines.
Options for TypeScript

Convert JSON to TypeScript interfaces

Paste a JSON sample and get matching TypeScript interfaces instantly. Nested objects become their own interfaces, arrays are typed from every element, fields missing from some records are optional, and mixed values become unions — the generated code is checked by compiling it in strict mode.

Choose interface or type, readonly fields, how optionals are written and unknown or any, and the choices are remembered. Everything runs in your browser: paste an API response, copy the interfaces into your codebase, and move on.

Need a different language? See all JSON-to-code converters.

JSON to TypeScript Converter — frequently asked questions

How do I generate TypeScript types from JSON?
Paste your JSON on the left and the TypeScript interfaces appear on the right instantly. Set the root type name, pick interface or type and readonly if you like, then copy the result into your project.
What if some records have fields that others don't?
Every item of every array and every sample is read, not just the first. A field missing from some records comes out optional, a field holding two kinds of value becomes a union (or the language's any-value type), null beside a value makes it nullable, and a list of records at the top level gets an item type plus an alias for the list. Paste several samples as JSON Lines, one per line, and they're merged the same way.
Is my JSON uploaded anywhere?
No. Parsing and code generation run entirely in your browser with JavaScript — your JSON never leaves your device, so it's safe to paste API responses and other sensitive payloads. It's free with no sign-up.

Spotted a bug or have a suggestion?

Found something broken, have an idea, or just want to say thanks about any of our tools? Every message reaches a real person.