JSON Schema to TypeScript screenshot

JSON Schema to TypeScript

Turn a JSON Schema into TypeScript interfaces: required properties plain, optional ones marked, nested objects given their own interface.

Privacy First
0 Runs
Updated 2026-11-17
Runs in your browser
No sign-up, no upload

What the JSON Schema to TypeScript does

The schema is read once into interfaces: type decides the primitive, enum becomes a union of its own values, and items decides the array's element type. required is the only thing that makes a property mandatory, which is exactly what the keyword means.

An object with a title keeps that title as its interface name; without one, the property name is used, PascalCased.

$ref, oneOf, anyOf, allOf, not, if and patternProperties are refused by name. A type given as a list of types is refused too: a union of types is a decision this page will not make for you.

How to use it

Paste the schema into the JSON Schema box, or press Run with the example already there.

Read the TypeScript below: the root interface comes first and any nested interface follows it.

Check a TypeScript property you expected to be required — it appears without a question mark only when the schema lists it in required.

Worked example

Input:

{
  "title": "User",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "address": {
      "type": "object",
      "properties": {
        "city": {
          "type": "string"
        }
      },
      "required": [
        "city"
      ]
    }
  },
  "required": [
    "id"
  ]
}

Output:

export interface User {
  id: number;
  name?: string;
  tags?: string[];
  address?: Address;
}

export interface Address {
  city: string;
}

Why it runs in your browser

The result is produced on this page with JavaScript, so it works offline after the page loads and nothing you enter is sent anywhere.

One interface per object schema, with the `required` list deciding which properties carry a question mark.

A nested object becomes its own interface named from its `title`, or from the property that holds it, so a deeply nested schema stays readable.

What it does, and what it does not

The schema is read once into interfaces: `type` decides the primitive, `enum` becomes a union of its own values, and `items` decides the array's element type. `required` is the only thing that makes a property mandatory, which is exactly what the keyword means.

An object with a `title` keeps that title as its interface name; without one, the property name is used, PascalCased.

`$ref`, `oneOf`, `anyOf`, `allOf`, `not`, `if` and `patternProperties` are refused by name. A `type` given as a list of types is refused too: a union of types is a decision this page will not make for you.

How to use JSON Schema to TypeScript

Paste the schema into the JSON Schema box, or press Run with the example already there.

Read the TypeScript below: the root interface comes first and any nested interface follows it.

Check a TypeScript property you expected to be required — it appears without a question mark only when the schema lists it in `required`.

What to Expect

Best for

  • Typing an API response from its JSON Schema
  • Seeing which properties the schema makes optional

Not ideal for

  • Schemas built from $ref, which are refused
  • A type given as a union of several types

What this tool keeps

  • The required list, exactly
  • Enum values as a string union

What may need cleanup

  • A union keyword needs flattening before it can be typed
  • A $ref needs inlining

Common errors

  • The page refuses it: uses $ref, which this page does not model

Example use cases

  • Generating response types from a published schema
  • Reviewing a schema change as a TypeScript diff

Sample input

JSON Schema: { …

Sample output

TypeScript: export interface User { …

Who this is for

  • Frontend developers consuming a documented API
  • Anyone keeping types in step with a schema

Frequently asked questions

Why is a property optional?

It is not listed in the schema's required array. The page never invents requiredness from the presence of a property.

What name does a nested interface get?

Its title when it has one, otherwise the property name PascalCased. Two properties that produce the same name would need a title on one of them.

Why refuse $ref?

Resolving one means following pointers, and a wrong resolution prints a type that compiles and misdescribes the data. The page asks you to inline the definition instead.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.