JSON to TypeScript
Interfaces from sample JSON
Turn sample JSON into TypeScript interfaces or type aliases, with nested objects, arrays and optional fields inferred.
No uploads
export interface Root {
id: number;
name: string;
email: string;
active: boolean;
tags: string[];
address: Address;
orders: Order[];
}
export interface Order {
id: string;
total: number;
coupon?: string;
}
export interface Address {
city: string;
zip: null;
} JSON to TypeScript — Turn sample JSON into TypeScript interfaces or type aliases, with nested objects, arrays and optional fields inferred. Free on ToolWand: no sign-up, no watermark, works offline.
How to use JSON to TypeScript
- 1Open JSON to TypeScript. It runs in your browser, no sign-up.
- 2Type or paste your input.
- 3Copy or download the result.
About JSON to TypeScript
JSON to TypeScript turns sample JSON into TypeScript interfaces or type aliases, inferring nested objects, arrays, optional fields and nullable values.
When to use it
- Type an API response quickly.
- Create types for config files or fixtures.
- Start a typed model from example data.
Tips
- Keys missing from some objects in an array are marked optional with ?.
- null is kept in a union such as string | null.
- Set a root name and choose export or readonly as needed.
Questions
How are optional fields detected?
When an array contains objects and a key is missing from some of them, that key is marked optional with ?.
What about null values?
null is kept in a union, e.g. string | null, so you can see which fields can be empty.
Is my JSON uploaded?
No — conversion happens entirely in your browser.
More tools
JSON Formatter & ValidatorPretty-print, minify, validate Base64 Encoder & DecoderText and files Hash GeneratorMD5, SHA-1, SHA-256, SHA-512 Password & UUID GeneratorStrong, random, local Regex TesterLive matches and groups JWT DecoderHeader, payload, expiry Diff CheckerCompare two texts CSV ↔ JSON ↔ YAML ↔ XMLConvert data formats