Developer Tools
JSON to TypeScript Converter
Convert JSON to TypeScript interfaces or types in your browser. Smart inference for nested objects, arrays, unions, optional keys, and readonly fields.
Output options
Live preview updates with every change. All inference happens in your browser; the JSON you paste is not uploaded.
Used as the name of the root interface or alias. Converted to PascalCase automatically.
Declaration style
interface emits `interface X `. type emits `type X = ` so the declarations can be intersected with `&`.
Quotes for non-identifier keys
Indent
How to use
- Paste a JSON value into the input on the left, or click Load sample JSON to see a worked example.
- Read the generated TypeScript on the right; one interface is emitted per nested object shape, with the root named after the Root type name field.
- Pick a declaration style (interface or type), set indent and quotes, and rename the root if you want something more specific than Root.
- Toggle Mark missing keys optional when working with arrays where not every element has every field, or Readonly fields for immutable models.
- Click Copy types to put the full output on your clipboard, ready to paste into a .ts file.
About this tool
JSON to TypeScript Converter turns any JSON value into a clean set of TypeScript declarations entirely in your browser. Paste an API response, a config file, a fixture, or a copied object literal, and the tool parses it with the browser's native JSON parser, walks the resulting tree, and emits one named interface per object shape with primitive scalars mapped to string, number, boolean, or null. Nested objects are extracted into their own named interfaces with PascalCase names derived from the parent key, so the output reads top-down from the root and references are easy to follow. Arrays infer their element type from the union of every element seen, so a list of mixed objects produces a merged shape and a list of mixed primitives produces a clean union like string | number. When the same key appears in some elements of an array but not others, an opt-in setting marks those keys with a question mark so the resulting interface accepts both shapes; otherwise every observed key is required. A second opt-in prepends readonly to every property for immutable models. Output options control the declaration form (interface for classic OOP-style declarations or type for unions and intersections), the indent (2 or 4 spaces), the quote style for non-identifier keys (single or double), whether keys are sorted alphabetically or kept in their original JSON order, and whether each declaration is exported. Reserved TypeScript words and keys with hyphens, spaces, or leading digits are quoted automatically so the result compiles without manual cleanup. Useful for typing API responses without writing boilerplate, modeling third-party JSON payloads, generating test fixtures with strict types, scaffolding GraphQL or REST clients, prototyping types from a sample document, and saving time on every Pull Request that adds a new endpoint. Parsing and inference run locally on your device, so the JSON you paste here never leaves your browser.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
JSON Formatter
Format, minify, and validate JSON in your browser.
Open tool
DeveloperJSON Diff Checker
Structural compare with paths for added, removed, and changed values.
Open tool
ConverterYAML to JSON Converter
Two-way YAML and JSON converter with anchors, flow, and block scalars.
Open tool
ConverterCSV to JSON Converter
Two-way CSV and JSON converter with delimiter and header controls.
Open tool