JSON to TypeScript

Paste JSON and instantly generate matching TypeScript interfaces, with nested objects and arrays turned into their own named types. Free and private, right in your browser.

Paste a JSON payload (an API response, a config file, a log entry) and get back TypeScript interfaces with correct field types, nested object types, and optional/array handling, no more hand-writing types for a shape you already have an example of.

How to use it

  1. Paste or upload your JSON
  2. Set the root interface name
  3. Copy or download the generated .ts file

Frequently asked questions

Does it handle nested objects and arrays?
Yes. Nested objects become their own named interfaces, and arrays are typed from their first element (or unioned across elements if they differ).
What happens with fields that are sometimes null?
A field that's null in some samples and a real value in others is typed as a union, e.g. `string | null`, rather than falling back to `any`.
Can I use this for an API response with inconsistent fields?
Paste a few sample responses if the shape varies. The generator merges them into one interface and marks fields that don't appear everywhere as optional.