toolready. JSON to TypeScript

JSON to TypeScript

Paste JSON, get TypeScript interfaces — types inferred live.

How do I convert JSON to TypeScript?

Paste a JSON value — typically a sample API response — into the left panel and the matching TypeScript interface declarations appear on the right, updating as you type. Set the Root name to control what the top-level interface is called.

Does it handle nested objects and arrays?

Yes. Nested objects become their own named interfaces, and arrays become typed arrays like string[] or User[]. When an array holds objects, their shapes are merged into a single interface so you get one clean type instead of many.

How are optional fields and unions detected?

If a key appears in some array elements but not others, it's marked optional with ?. When a value varies in type — say numbers and strings, or something that's sometimes null — the result is a union like (number | string)[] or string | null.

Is my JSON uploaded?

No. The conversion runs entirely in your browser. Your JSON never leaves your device, so it's safe to paste real payloads.

Common use cases

  • Bootstrapping types from an API response or config file.
  • Turning a fixture or mock into a reusable interface.
  • Documenting the shape of JSON you receive from a third party.