JSON to TypeScript

Paste any JSON and instantly get TypeScript interface definitions. Supports nested objects, arrays, and mixed types — perfect for typing API responses.

About JSON to TypeScript

This converter reads any valid JSON and produces TypeScript interface definitions for it. It handles nested objects (by generating separate interfaces), arrays of primitives and objects, and mixed types with union annotations.

Options

  • Root interface name — Name of the top-level interface.
  • Optional nullable fields — Adds ? to fields whose value is null.
  • Export interfaces — Prepends export to each interface.
  • Readonly fields — Marks every field as readonly.

How to use

  1. Paste your JSON into the input box on the left.
  2. (Optional) Change the root interface name and options.
  3. Click Convert — the TypeScript output appears on the right.
  4. Click Copy Output and paste into your .ts file.

Frequently asked questions

How are arrays of objects handled? Each unique object shape in an array becomes its own interface, and the field is typed as InterfaceName[].

What about mixed-type arrays like [1, "two"]? The converter emits a union: (number | string)[].

Is my data sent anywhere? No — conversion happens entirely in your browser. Nothing is uploaded.