JSON to TypeScript
Paste a JSON object or array and get back clean TypeScript interfaces, inferred recursively for nested objects and arrays. Handles mixed-type arrays and merges inconsistent object shapes automatically.
Paste any JSON value and set a root interface name. Nested objects become their own named interfaces, arrays of objects merge every observed key into one element type, and primitives map to their TypeScript equivalent.
JSON
TypeScript
Frequently asked questions
How are arrays with mixed item shapes handled?
If every element is an object, their keys are merged into a single interface (fields missing from some elements are still included). If elements are different primitive types, the result is a union type array.
Does it handle deeply nested objects?
Yes — every nested object gets its own named interface, generated recursively from the property name it was found under, so the output stays readable rather than one giant inline type.
What happens with a key that isn't a valid identifier?
Keys that aren't valid TypeScript identifiers (like ones with spaces or hyphens) are automatically quoted in the generated interface, e.g. "user-id": string;.