JSON to TypeScript
Generate TypeScript interfaces from JSON samples.
The JSON to TypeScript tool generates TypeScript interfaces from JSON samples. It infers primitive types, creates nested interfaces for objects, and handles arrays of objects automatically.
Please enter some input.
How to use
- Paste a JSON object or array into the input field.
- Set the root interface name and toggle optional fields or export prefixes.
- Copy the generated TypeScript definitions.
Frequently asked questions
Which JSON values are supported?
Objects, arrays, strings, numbers, booleans and null are inferred; empty arrays become unknown[].
Can I rename the root interface?
Yes, the root name defaults to Root and can be changed to any valid TypeScript identifier.
Related tools
JSON Formatter
Format, validate and minify JSON in one place.
XML Formatter
Pretty-print and indent XML documents.
YAML Formatter
Format YAML and convert between YAML and JSON in both directions.
CSV to JSON
Convert CSV tables into JSON data.
JWT
Encode, decode and verify JSON Web Tokens locally.
Hash Generator
Generate SHA-1, SHA-256, SHA-384 and SHA-512 hashes.