Data to Class

JSON to TypeScript

Generate accurate TypeScript interfaces from any JSON — or paste TypeScript types to generate matching sample JSON.

Loading JSON ↔ TypeScript…

How it works

How to use the JSON ↔ TypeScript

  1. Paste a JSON response

    For example, from an API you are integrating with.

  2. Name the root type

    Nested objects get their own named interfaces, derived from their keys (items → Item).

  3. Copy into your project

    Or switch to TypeScript → JSON to create mock data from existing types.

Smart type inference

Array elements are merged so fields that appear only sometimes become optional (gift?: boolean), mixed values become unions (string | number), and identical nested shapes share a single interface. Keys that are not valid identifiers are quoted automatically.

The reverse direction understands interfaces, type aliases, enums, unions, arrays, Record<K, V>, extends and utility types like Partial<T>, and fills in realistic sample values based on field names.

Built for developers

Why developers use it

  • Private by design

    Runs 100% in your browser. Nothing you paste is uploaded, logged or stored on a server.

  • Instant results

    Output updates as you type, with precise error locations when something is wrong.

  • Works offline

    Once loaded, the tool keeps working without a connection. Install it as an app if you like.

  • Free, no sign-up

    No accounts, no limits, no watermarks.

FAQ

Frequently asked questions

Interface or type alias?

Both describe object shapes equally well. Interfaces can be extended and merged; type aliases can express unions. Pick whichever your codebase uses.

How are null values typed?

As a union with null (field: string | null). Enable "null → optional" to write field?: string instead.

Is my data uploaded anywhere?

No. This tool runs entirely in your browser. Your input never leaves your device, is not logged, and works offline once the page has loaded.

Keep going

Related tools

Private by design

Your data never leaves your browser.

498 free tools that run locally — no uploads, no sign-up, no tracking of what you paste. They even work offline.

  • 498free tools
  • 0bytes uploaded
  • 23categories