JSON to TypeScript Tool

Generate TypeScript interface / type definitions from JSON. Nested structures and array element types are inferred automatically.

Last updated: 2026/10/16 Developer Feedback & bug reports
Input (JSON)

How to Use

1

Enter JSON

Type or paste your JSON (API response, config file, etc.) into the text area.

2

Set options & generate

Choose the root type name, output style, optional and readonly, then click "Generate Types".

3

Copy the result

Copy the generated TypeScript definitions or download them as a .ts file.

About JSON to TypeScript

An online tool that generates TypeScript interfaces or type aliases from JSON data. Nested objects are split into separate named types, and array element types are inferred. Arrays of multiple objects are merged by key, treating missing keys as optional properties. All processing happens in your browser, so even sensitive data stays private.

Features

  • Nested structure supportNested objects are split into separate interfaces automatically for highly readable types.
  • Array element inferenceArray contents are analyzed to infer element types. Mixed values become union types.
  • optional / readonlyToggle properties to optional (?) or readonly to match your project conventions.
  • Fully in-browserYour JSON is never sent to a server. All conversion runs locally in your browser.

Use Cases

  • Create response types from API JSON
  • Type your JSON configuration files
  • Generate types from mock data to speed up front-end work
  • Type third-party webhook payloads
  • Type existing JSON data during a TypeScript migration

FAQ

Is this tool free to use?
Yes, it is completely free with no registration required. Just open it in your browser and start using it.
Is my JSON sent to a server?
No. Type generation happens entirely in your browser (JavaScript). Your JSON is never sent to or stored on any server.
Can I output interface or type?
Both are supported. Use the "Output style" option to pick interface or type alias; nested types are emitted in the same style.
How are array element types inferred?
Each array element is analyzed to infer its type. If all elements are objects, their keys are merged into one type, and keys present in only some elements become optional (?). Mixed types are emitted as union types.
Does it handle null and deeply nested JSON?
Yes. null is treated as the null type, and nested objects are split into separate types at any depth. Colliding type names are disambiguated with a numeric suffix.