JSON to TypeScript Converter
Convert a JSON object into TypeScript interfaces instantly in your browser, with types inferred automatically.
How to use this tool
Typing out interface definitions by hand for an API response or config file is tedious and easy to get subtly wrong. This tool reads a JSON sample and generates matching TypeScript interface definitions automatically — inferring strings, numbers, booleans, arrays, and nested objects, and splitting nested structures into their own named interfaces rather than one giant inline type.
For example, {"name": "Alice", "address": {"city": "NYC"}} generates:
interface Address {
city: string;
}
interface Root {
name: string;
address: Address;
}Paste your JSON into the input box on the left, set the Interface name you want for the top-level type, and click Convert. The generated TypeScript appears in the output box on the right, with any parse errors shown below.
FAQ
Is this JSON to TypeScript converter free to use?
Yes, this tool is completely free to use with no limits on how often you can use it.
Does my JSON get uploaded anywhere?
No. The interface is generated directly in your browser. Your data never leaves your computer.
How does it handle arrays of objects with slightly different fields?
It merges the shapes of every object in the array into a single interface. A field present in only some elements — or that's null in some of them — is marked optional (with a ?) rather than being dropped or causing an error.
Why did a null field become "field?: any" instead of a real type?
A null value on its own carries no type information — there's no way to know whether the real value is normally a string, a number, or something else from a single null sample. Marking it optional with type any is the honest result: it tells you the field might be absent, and you should narrow the type yourself once you know what it actually holds.
Related Tools
JSON to Python Converter
Generate Python dataclasses from a JSON sample, with types inferred automatically.
Regex Tester
Test regular expressions with live-highlighted matches and groups.
Cron Expression Parser
Explain a cron expression in plain English and see its next 5 run times.
cURL to Python/JavaScript Converter
Convert a cURL command into equivalent Python (requests) or JavaScript (fetch) code.