JSON to TypeScript
Paste a JSON sample and get ready-to-use TypeScript interfaces — nested objects named, array element types inferred.
interface Root {
id: number;
name: string;
active: boolean;
roles: string[];
profile: Profile;
}
interface Profile {
age: number;
city: string;
}Types are inferred locally in your browser — your JSON never leaves the page.
Turn a JSON sample into typed interfaces
Copy a response from an API, a config file, or a database row, paste it in, and get a set of TypeScript interfaces that describe its shape. Nested objects are lifted into their own named interfaces, arrays get proper element types, and primitives map to string, number and boolean. It's the fastest way to stop hand-writing types for data you already have an example of.
A starting point, not the final word
Type generation from a single example is inference, so treat the output as a strong first draft. A field that happens to be null or an empty array in your sample can't be fully inferred, and optional fields won't be marked with ? unless they're missing. Skim the result, widen nullable unions, and add optionality where your real data needs it — then paste it straight into your codebase.
FAQ
How are nested objects handled?
Each nested object becomes its own named interface (derived from the key name), and the parent references it by name. This keeps the output readable and reusable rather than producing one giant inline type.
How does it decide array element types?
It infers the type of each element and unions the distinct ones. An array of strings becomes string[]; a mixed array becomes a union like (string | number)[]; an empty array becomes unknown[] since there's nothing to infer from.
What happens with null values?
A null value is typed as null. Because a single sample can't tell you whether a field is always null or sometimes populated, review nullable fields and widen them (e.g. string | null) where your real data allows it.
Can it generate types for a whole API response?
Yes — paste a representative response and it generates the full interface tree. For fields that are optional in your API, add ? manually, since one example can't reveal optionality.
Is my JSON uploaded anywhere?
No. Parsing and type generation run entirely in your browser, so you can paste internal or production payloads without them leaving your machine.
Free tools are just the start
Deploy your next app on bare-metal cloud with per-second billing — your first app is free, no credit card required.
More free tools
Placeholder paragraphs plus fake names, emails, phone numbers and addresses for testing UIs.
Convert JSON to spreadsheet-ready CSV or CSV back to JSON — nested objects flattened, both directions.
Test regular expressions against your text with live match highlighting and capture groups.
Compare two blocks of text or code line by line and see exactly what was added or removed.
Count words, characters, sentences and paragraphs with reading and speaking time estimates.
Convert text between camelCase, snake_case, kebab-case, PascalCase, Title Case and more.