Skip to content

JSON to TypeScript Converter

Generate TypeScript interfaces or types from a JSON sample, with nested types, optional fields and unions inferred automatically.

  • Free, no sign-up
  • Runs in your browser
  • Reviewed Nov 6, 2026

How to use the JSON to TypeScript Converter

  1. Paste a JSON sample (an API response works well).
  2. Set the root type name and choose interface or type.
  3. Copy the generated TypeScript.

How it works

The JSON is parsed and each value's shape inferred. Objects become named interfaces (named after their key, singularised for arrays). Array items are merged so keys missing from some items become optional and mixed value types become unions. Runs entirely in your browser — nothing you paste is sent to our servers.

Worked examples

API response

{"orders": [{"id": "A1", "coupon": null}, {"id": "A2", "items": 3}]} produces an Order interface with id: string, coupon?: null and items?: number.

Limitations and assumptions

  • A single sample can't reveal every possible value — review the types, especially nulls and empty arrays (typed unknown[]).

Frequently asked questions

Interface or type?

Both work for object shapes. Interfaces can be extended and merged; types can express unions. Pick your team's convention.

G

Built and reviewed by Guru G

Calculation logic is covered by automated tests against known values. Last reviewed Nov 6, 2026. Found a problem? Let us know — see our editorial policy.