Skip to content
Jellykit

JSON to TypeScript

Generate TypeScript interfaces or types from a JSON sample. Nested objects get their own interface, optional and nullable fields are detected. Free and private.

Runs in your browser. Nothing is uploaded.

About JSON to TypeScript

Paste an API response and get TypeScript interfaces that describe it. Every nested object becomes its own named interface, arrays of objects are merged so a key missing from some items becomes optional (key?), and null values produce union types.

Choose interface or type alias, readonly properties and whether to export. It's a fast way to type a fetch() result without writing declarations by hand.

How to use JSON to TypeScript

  1. Type or paste your text into the input box. Press Sample to see an example.
  2. Adjust the options. The result updates as you type.
  3. Copy the result, or press Use as input to chain another transformation.

Frequently asked questions

How are optional fields detected?

When an array holds several objects, a key that's missing from any of them is marked optional.

Can it infer unions like 'a' | 'b'?

No. A single sample can't tell a fixed set of values from free text, so strings are typed as string. Narrow them by hand where needed.

Is JSON to TypeScript free and private?

Yes. JSON to TypeScript is completely free with no sign-up. Everything runs in your browser, so whatever you type or paste never leaves your device.

See all developer tools →