JSON to TypeScript Generator
Generate TypeScript interfaces and types from a JSON sample locally.
JSON sample
TypeScript
About
Infer readable TypeScript interfaces from JSON objects, arrays, primitives, null values, and property names that require quoting.
Key Features
- Nested interfaces
- Heterogeneous array unions
- Quoted invalid identifiers
- Copy and TypeScript download
How to use
- 1Choose a root type name.
- 2Paste a valid JSON sample.
- 3Generate, review, and copy or download the TypeScript.
Example
Input
{"user-name":"Ada","active":true}Output
export interface RootObject {
"user-name": string;
active: boolean;
}Limitations
- Input is limited to 2,000,000 characters.
- Fields are required because one sample cannot prove optionality.
- Empty arrays become unknown[].
Last reviewed: