Skip to content
Tool Dock

JSON to TypeScript

Turn a JSON sample into TypeScript interfaces, nested types included.

Options

Input

Waiting for input

Output

or press ⌘/Ctrl + Enter
  • Runs in your browser
  • Nothing is uploaded
  • Free, no sign-up

How to use it

  1. Paste a JSON object or array, for example an API response.
  2. Name the root type and choose interface or type alias style.
  3. Copy the generated types into your project.

Why Tool Dock

  • FastEverything runs on your own device, so there is no queue and no waiting for uploads.
  • PrivateYour files and text never leave the browser. Close the tab and they are gone.
  • Batch friendlyDrop several files at once and download each result, or all of them together.

Questions

How are arrays of objects handled?

Every element is merged into one type. A field present in some elements but not others becomes optional, and different value types become a union.

Where do the type names come from?

From the property names, converted to PascalCase and singularised for arrays, so “users: [...]” becomes User[]. Clashes get a number suffix.

Why are some fields typed as null or unknown?

A null in the sample is typed as null (combine it with the real type yourself), and an empty array has no elements to learn from, so it becomes unknown[].

All tools