JSON to TypeScript
Generate TypeScript interfaces from a JSON document, with nested objects as named sub-interfaces.
Related tools
JSON to TypeScript
Paste a JSON document — an API response, a config file, a database row — and get ready-to-use TypeScript declarations. Types are inferred recursively: primitives map to string, number and boolean, arrays carry their element type, and mixed arrays become clean unions such as (number | string)[]. Every nested object becomes a named sub-interface derived from its property key in PascalCase, so a "user" property produces a User interface you can import and reference anywhere.
Identical shapes are detected and reuse a single interface instead of generating duplicates; a numeric suffix appears only when two objects share a key name but differ in structure. Empty arrays come out as unknown[] and empty objects as Record<string, unknown> — honest placeholders rather than guesses. Property names that are not valid identifiers are quoted automatically, so kebab-case and numeric keys survive intact.
The options cover real project conventions. Name the root type, choose between interface and type declarations, export everything or nothing, mark all properties readonly, and decide how null values are treated — as an explicit null type or as optional properties. Invalid JSON produces a calm error with the line and column of the problem, the same way the JSON formatter reports it.
Everything runs locally in your browser: API responses with tokens, user records or internal payloads never leave your machine. Paste, copy the declarations into your codebase, and the shape of your data is typed.