Skip to main content
ConduitTools by ConduitCode Labs

Converters

JSON to TypeScript Converter

Paste a JSON response and get TypeScript types for it, with a named interface for every nested object and optional fields worked out from your data.

  • Free
  • No sign-up
  • Runs in your browser
Waiting for JSON
JSONA sample of the data
TypeScriptInterfaces or type aliases
No types yet

Paste a JSON sample and matching TypeScript types appear here, with a named type for every nested object.

0 BInput size
Output size
What it handles

Types from real data, not guesses.

Writing types for an API response by hand is slow and error-prone. Start from a real sample and adjust from there.

A type for every object

Each nested object becomes its own named interface, in the order they appear, with names taken from the keys such as User or Address.

Arrays are merged

When an array holds several objects, they are combined into one type. A field missing from some of them becomes optional, and mixed values become a union.

Nullable and unknown

A null value becomes | null, and an empty array becomes unknown[] because there is nothing to learn its type from.

Frequently asked questions

Are the generated types guaranteed to be right?

They describe the sample you gave. A field that happens to be a string in your sample might sometimes be a number in production, so review the result and give it a wider sample when you can.

Interface or type?

Both describe object shapes. Interfaces can be extended and merged; type aliases are more flexible for unions. Choose whichever your codebase uses.

How are optional fields decided?

Within an array of objects, any key that is missing from at least one element is marked optional with a question mark.

What about keys that are not valid identifiers?

Keys such as content-type are written as quoted properties, which is valid TypeScript.

Keyboard shortcuts

CtrlK
Search all tools
/
Search the directory (on the homepage)
CtrlEnter
Copy or download the result
CtrlShiftEnter
Generate a new password or new text
?
Show this list
Esc
Close a dialog or menu