Skip to content
toolstome

JSON to TypeScript converter

Paste an API response or a JSON file and get TypeScript types for it. Every nested object becomes its own named interface, arrays of objects are merged so that keys missing from some items become optional, values that differ between items become union types, and identical shapes are reused instead of repeated. Choose interfaces or type aliases, export them or not, and make properties readonly. Keys that aren’t valid identifiers are quoted. The conversion runs in your browser, so private API data never leaves your device.

Free · No sign-upProcessed in your browser

Declare as

How to use the JSON to TypeScript

  1. 1

    Paste JSON

    An object or an array, for example an API response.

  2. 2

    Choose options

    Root name, interface or type, export and readonly.

  3. 3

    Copy or download

    Use the types in your project.

When to use it

  • Type an API response quickly.
  • Document the shape of a configuration file.
  • Start a typed model for data you receive.

Limits

  • Types are inferred from the sample only; values that never appear (like a null field that is sometimes a string) can’t be known.
  • Dates and IDs stay string or number; refine them by hand if needed.

Privacy

Runs entirely in your browser; your JSON is not uploaded.

Frequently asked questions

How are optional properties decided?

In arrays of objects, a key that is missing from at least one item is marked optional with ?.

What happens with mixed types?

If a key holds a number in one item and a string in another, the type becomes number | string.

Why is a type named Item or ending in 2?

Names come from keys. When a key gives no usable name, or two different shapes would share a name, a fallback or number is used.

Interface or type alias?

For object shapes they are nearly equivalent. Interfaces can be extended and merged; type aliases can express unions. Pick what your codebase uses.

What about empty arrays?

An empty array has no sample items, so it becomes unknown[]; replace it with the right type.

People also use

Last updated November 24, 2026 · How we build and test our tools

Categories

Recently used tools

Tools you open will appear here.

More