JSON to TypeScript Interface Generator
Generate TypeScript interfaces from a JSON sample.
Input
This tool runs entirely in your browser. The data you paste or load is never uploaded.
Result
Enter your input, then run the tool.
About this tool
Infers TypeScript interfaces from a JSON example, naming nested objects after their keys, merging the shapes of array items and marking keys that are missing from some items as optional. Paste an API response and copy ready-to-use types.
How to use it
- Paste a JSON object or array, such as an API response.
- Choose the root interface name and the declaration style.
- Press Generate and copy the TypeScript.
Frequently asked questions
How are arrays of objects handled?
The keys of every item are merged into one interface. A key missing from some items becomes optional (key?: type).
What type does null get?
A key that is null in the sample becomes “type | null”, or “unknown | null” when no other value tells the real type.
Keep going
Related tools
JSON Formatter
Pretty-print compact or broken JSON with a readable indentation.
JSON Validator
Check JSON syntax and see exactly where it breaks.
YAML to JSON Converter
Convert a YAML document into JSON.
JSON Minifier
Strip whitespace from JSON to shrink payloads.
JSON to CSV Converter
Turn an array of JSON objects into a spreadsheet-ready CSV.
CSV to JSON Converter
Convert CSV rows into structured JSON, with type detection.