JSON to TypeScript Interface

JSON to TypeScript Interface

Instantly convert any JSON object into clean TypeScript interfaces. Free online tool — supports nested objects, arrays, and optional fields. No install needed.

Updated April 2026

Root Interface Name
Output
1
TypeScript Interface

// Paste JSON on the left // to generate TypeScript interfaces

Shift + Enter to Copy

How to convert JSON to TypeScript

From raw JSON to production-ready interfaces in three steps

1. Paste your JSON

An API response, a config file, a database record — any valid JSON object or array works.

2. Name the root interface

Defaults to `RootObject` — rename it to something that matches your domain, like `User` or `Product`.

3. Copy the result

Click Copy or press `Shift+Enter`, then paste straight into your `.ts`/`.tsx` files.

What this JSON to TypeScript generator does

Handles the full range of JSON shapes you'll actually paste in

Nested objects

Every inner object gets its own named interface, ordered so dependencies appear before they're used.

Typed arrays

Primitive arrays become string[]/number[]; arrays of objects generate an interface plus [].

Interface / type toggle

Switch between interface and type output to match your project's convention.

Null fields

null values are typed correctly, ready for you to widen into a union type where needed.

How each JSON type maps to TypeScript

JSON
TypeScript
string
string
42
number
true
boolean
["a", "b"]
string[]
{"profile": {...}}
profile: Profile (+ separate Profile interface)

When you'll reach for this tool

The scenarios developers hit most often

Type REST API responses

Paste the JSON your backend returns and get interfaces ready to plug into fetch or axios.

Type configuration files

Turn a config.json into an interface so your editor autocompletes every key.

Skip the boilerplate

Stop hand-writing interfaces for deeply nested payloads and let the generator do it in one paste.

Integrate third-party APIs

Paste a sample response to understand the shape and generate a starting set of types.

Common mistakes

Expecting automatic optional fields

The generator types based on the sample you provide — fields that might be missing still need a manual ? afterward.

Treating `null` as the final type

In production code, widen it to string | null (or whatever the field can actually hold).

Empty arrays without context

These come out as unknown[] — the element type can't be inferred without at least one sample item.

Why use this converter

It walks nested structures recursively, generating one interface per level and ordering them so dependencies are declared before they're referenced — no manual sorting required.

Output is compatible with TypeScript 3.0+ and works the same in React, Next.js, Vue, Angular, or plain Node.js — nothing framework-specific about the generated types.

`interface` vs. `type`

Both are available via the toggle in the tool

interface
type
Supports `extends`
yes
via intersection (`&`)
Declaration merging
yes
no
Best for
public APIs, libraries
complex unions and intersections

Frequently asked questions

Paste the JSON and the generator handles nested objects recursively, giving each one its own named interface, ordered so dependencies appear before they're used. There's no depth limit — deeply nested API responses work the same as flat ones.

Further reading

Related Tools