What is JSON to TypeScript?

JSON to TypeScript turns JSON data into TypeScript interfaces and type definitions. It picks up strings, numbers, booleans, arrays, and nested objects, and marks nullable fields as optional with union types. Skip the tedious part of typing out API responses by hand.

How to use

  1. Step 1 — Paste a JSON object or array. The tool analyzes the structure and infers TypeScript types for every field.
  2. Step 2 — Customize the output: set the root interface name, choose between interfaces and type aliases, and toggle optional properties for fields that may be null.
  3. Step 3 — Copy the generated TypeScript definitions or download as a .ts file. All nested objects get their own named interfaces automatically.

Result

Your API returns a user object with nested address and preferences. Paste the JSON response, set root name to 'User', and get clean interfaces: User, UserAddress, UserPreferences — with correct types like 'string | null' for optional fields.

Related Tools