What is JSON to TypeScript?
The generator inspects a sample value and writes a matching TypeScript type: strings, numbers, booleans, null, arrays, and nested objects. It describes the sample you provide, so review optional fields and unions before relying on it.
How to use JSON to TypeScript
- Paste your input into the editor above, or select Sample to load an example.
- Select Generate types. If the input cannot be processed, a message explains what to fix.
- Use Copy or Download to take the result with you, and Clear to start again.
Example
Input
{"id":7,"name":"Ada","tags":["admin"]}Output
export interface Root {
id: number;
name: string;
tags: string[];
}Practical use cases
- Type API responses
- Draft data models
- Document object shapes
Common problems
- Using an unrepresentative sample
- Assuming generated types validate runtime data
- Forgetting optional fields absent from the sample
Frequently asked questions
Is JSON to TypeScript free to use?
Yes. JSON to TypeScript is free and does not require an account.
Does my input leave the browser?
No. This tool performs its processing locally in your browser and does not need to upload your input.
