JSON to TypeScript
Infer readable TypeScript types for nested objects, arrays, and mixed values from a JSON sample.
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
- Paste a representative JSON sample.
- Choose a valid root type name.
- 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.