JSON to TypeScript

Infer readable TypeScript types for nested objects, arrays, and mixed values from a JSON sample.

Private by default. Your input stays in your browser.Learn more
Inferred types only describe your sample. Empty arrays use unknown[]. Review optional fields, dates, and domain rules before using the result.

What does this tool do?

A JSON to TypeScript converter infers types from the values in a JSON sample. Review the result before use because a single sample may not show optional fields or every possible value.

When to use this tool

Start a TypeScript definition from a representative API response or configuration object. The result describes the values present in your sample. Review optional properties and other possible responses before adopting the generated types in a project.

How to use JSON to TypeScript

  1. Paste a representative JSON sample.
  2. Choose a valid root type name.
  3. Generate and copy the inferred TypeScript definition.

A quick example

{"name":"Alex","active":true} → type Root = { name: string; active: boolean; };

Common questions

How are mixed arrays represented?

Mixed entries produce a union of the observed item types. Distinct object shapes remain a union rather than assuming every property is required.

Does this generate runtime validation?

No. TypeScript types help during development, but do not validate API responses at runtime.

Working with a large input? Text converters accept up to 1,000,000 characters. Regex test text is limited to 50,000 characters and JWTs to 100,000.