Skip to content
Frisbly
Sign in

JSON to TypeScript

Paste JSON or open a .json file and get TypeScript interfaces or types, with optional keys and unions.

Output form

TypeScript

The TypeScript appears here.

The JSON stays in this browser. It is not uploaded, saved or put in the address bar.

The JSON you enter never leaves this device.

How to use it

  1. 1

    Paste JSON or open a file

    Paste JSON into the box, or open a .json file of up to 5 MB. The file is read in this browser and is not uploaded.

  2. 2

    Pick the output form

    Choose interface or type, and type a name for the top type. An empty name uses Root. Other names are taken from the keys.

  3. 3

    Read the types

    Objects in an array are merged into one type, and a key missing from some of them becomes optional with a question mark. A value that is sometimes null becomes a union with null, and an empty array becomes unknown[].

  4. 4

    Copy the result

    Press Copy result. The types come from one sample, so other data with the same shape may need a wider type. Nothing leaves this browser.

Cookie choices

We use essential local storage for your choices. Optional anonymous analytics help us understand aggregate usage and improve reliability. Privacy Policy