JSON to TypeScript
Generate TypeScript types from JSON, in your browser.
Recommended next steps
Related tools
Format, validate, and beautify JSON, in your browser.
Convert JSON arrays to CSV and CSV back to JSON, in your browser.
Test a regular expression against text and see matches and capture groups.
Frequently asked questions
No. Parsing and type generation run entirely in your browser using the built-in JSON parser. Nothing you paste is sent to a server, so it is safe to use with private or production data.
Each nested object becomes its own named interface, referenced by name from the parent. Arrays of objects are merged into a single element interface, and keys missing from some elements are marked optional with a ?. Arrays of primitives become a typed array such as string[], and empty arrays become unknown[].
Interface mode emits TypeScript interface declarations; type mode emits type aliases (type X = { … }). Both describe the same shape — pick whichever your codebase prefers. You can also choose 2-space, 4-space, or tab indentation and name the root type.
A field that is null in one sample and a value in another becomes a union with null kept last, like string | null. An array mixing several primitive types becomes a parenthesised union such as (string | number)[]. Because JSON has no integer type, every number is typed as number.
Last updated 2026-06-23.