JSON to TypeScript Interfaces

Paste JSON, get clean nested TypeScript interfaces or type aliases.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

A fast JSON to TypeScript converter that turns any JSON object, array or API response into clean, ready-to-paste interfaces or type aliases. Paste your data on the left and the typed definitions appear on the right instantly — no build step, no sign-up, and nothing is ever uploaded. It is built for the everyday job of consuming an untyped REST endpoint, a config file or a webhook payload and wanting accurate types without hand-writing them field by field.

How it works

The tool first parses your JSON with the browser’s native parser, so you get precise error messages if a comma or quote is out of place. It then walks the parsed value and infers a type for every node: primitives map straight to string, number and boolean; nested objects are lifted into their own named interfaces and referenced by name; and arrays are inspected element by element so the element type is inferred rather than left as any.

When an array holds several objects, their shapes are deep-merged into a single interface. A key that is present in some elements but not others is marked optional with a ?, and a key whose value differs in type across elements becomes a union such as string | number. Structurally identical shapes anywhere in the tree are detected and collapsed into one reused interface, so you never get three copies of the same record under different names. Property names that are not valid identifiers are automatically quoted, and reserved words are kept clear of your type names.

You control the output: pick interface or type aliases, choose between T[] and Array<T> array syntax, toggle export, add readonly modifiers, turn null fields into optional properties, and flag ISO-8601 date strings. Your option choices are remembered in this browser between visits. When you are happy, copy the TypeScript to your clipboard or download it as a .ts file. Because every step is client-side, the tool works offline and your payloads stay completely private — ideal for proprietary or sensitive API responses you would never want to paste into a remote service.

Example

Paste an object like a user record with a nested profile and an array of roles, each role carrying a name and a scopes string array. The generator emits a top-level Root interface plus a Profile, a Social and a Role interface. Because one role includes a temporary boolean and another omits it, temporary is correctly emitted as optional. A createdAt value that matches the ISO date pattern keeps the string type but gains a // ISO-8601 date string comment. The whole result is a tidy set of named declarations you can drop straight into a types.ts file.

JSON valueInferred TypeScript
"hello"string
42number
["a", "b"]string[]
{ "x": 1 }a named interface with x: number
key missing in some array itemsfield?: ...
mixed value types`string
null`…

Every figure and definition is generated in your browser — no data is uploaded or stored.

Ad placeholder (rectangle)