JSON to TypeScript
Paste JSON and get TypeScript interfaces or type aliases instantly. Nested objects, arrays, and optional fields are handled — all in your browser.
Valid JSON
JSON
TypeScript
How to use it
- 1Paste a JSON object or array on the left.
- 2Set a root type name and choose interface or type alias output.
- 3Copy the generated TypeScript from the right.
Common use cases
- Type an API response you just got back from a fetch call.
- Bootstrap types from a sample payload instead of writing them by hand.
- Keep front-end types in sync with a backend's JSON shape.
- Turn a config file into a typed structure for safer code.
Frequently asked questions
- Does it handle nested objects and arrays?
- Yes. Nested objects become their own named types, and arrays are typed by their element shape.
- How are optional fields detected?
- When an array contains objects with differing keys, keys missing from some elements are marked optional with `?`.
- Interface or type alias?
- Both — toggle between `interface` and `type` output. Interfaces are common for object shapes; type aliases are handy for unions and composition.
- Is my JSON uploaded?
- No. Conversion happens entirely in your browser — your data never leaves your device.
Try next
JSON Formatter and Validator
Free online JSON formatter, validator, and beautifier — pretty-print, minify, diff, and explore JSON. Nothing ever uploaded.
YAML ↔ JSON Converter
Bidirectional YAML / JSON conversion with multi-document support and indentation control. Free, in your browser.
XML Formatter & Validator
Format, validate, and minify XML documents with custom indentation — uses the browser's native DOMParser, nothing uploaded.