JSON to TypeScript

Paste JSON and get clean TypeScript interfaces: nested objects, arrays, deduplicated shapes and a custom root name. Runs entirely in your browser.

Everything runs in your browser — your data is never sent to any server.

Why generate types from JSON

When an API returns a payload, someone has to describe it in TypeScript by hand — field by field, level by level. It is slow, and the second version of the endpoint makes it stale. This tool reads the JSON once and writes the interfaces for you: every nested object becomes an interface, arrays become typed lists, and identical shapes are deduplicated automatically.

What it does

  • Interfaces for every nested object, with correct field names — quoted where necessary.
  • Typed arrays, including unions when an array mixes shapes.
  • Deduplication: objects with the same shape reuse one interface, and a custom root name.

How to use

  1. Paste your JSON (an API response, a config, anything valid).
  2. Set the root interface name if you dislike the default.
  3. Copy the generated TypeScript into your project.

How it works

The generator walks the parsed JSON recursively, infers a type per value, names object interfaces after their key in PascalCase and remembers each shape’s signature so identical objects reuse a single interface. Everything runs locally in your browser.

Frequently asked questions

How are field names handled?

Interface names are converted to PascalCase, and keys that are not valid TypeScript identifiers are preserved but quoted — exactly how the language expects them.

What happens with empty arrays or nulls?

An empty array becomes unknown[] (there is nothing to infer from), null becomes the null type, and mixed arrays produce a union of the types found inside.

Related tools