Skip to main content
T

JSON to TypeScript

Paste a JSON payload and instantly get TypeScript interfaces (or type aliases) describing its shape. Optionally mark all properties as optional or readonly. Useful for API mock data, fixtures, or quick type stubs.

Advertisement

How to use JSON to TypeScript

  1. Paste valid JSON.
  2. Set the root interface name.
  3. Pick interface or type alias, and optional flags.
  4. Copy the generated TypeScript.

What is JSON to TypeScript?

The tool walks the JSON tree, infers types (string / number / boolean / null / array / object), recursively generates a named interface for each object, and assembles them into a clean TypeScript file. Mixed-type arrays become union arrays (e.g., (string | number)[]).

Advertisement

FAQ

What about discriminated unions?
Not auto-detected. The tool generates structural types from a single sample. Hand-merge unions if you have multiple samples.

Related tools