JSON → TypeScript
Generate TypeScript interfaces or type aliases from JSON. Handles nested objects, arrays, unions, and nullable types.
Root type name
JSON input
TypeScript output
interface Address {
street: string;
city: string;
zip: string;
}
interface Order {
id: number;
total: number;
items: string[];
}
interface Root {
id: number;
name: string;
email: string;
active: boolean;
address: Address;
tags: string[];
orders: Order[];
metadata: unknown | null;
}Related tools
JSON to Zod SchemaCode
Generate Zod validation schemas from JSON objects with proper TypeScript types.
JSON to Go StructCode
Generate Go structs from JSON with proper json tags.
JSON to Python DataclassCode
Generate Python dataclass code from JSON with type hints.
JSON to Java POJOCode
Generate Java POJO classes from JSON with getters, setters, and constructors.
JSON to Rust StructCode
Generate Rust structs from JSON with serde derive macros.
JSON to C# ClassesCode
Generate C# classes from JSON with public properties and using statements.
About JSON to TypeScript
Generate TypeScript interfaces or types from a sample JSON object, inferring field names and types automatically. Saves you from hand-writing types for API responses and keeps your code in sync with real payloads.
How to use
- Paste a representative JSON response into the input.
- Review the inferred interfaces, including nested objects and arrays.
- Copy the generated types into your codebase and adjust optionality where needed.
Frequently asked questions
- Does it infer optional fields?
- It infers types from the sample you provide; fields absent in some objects may need to be marked optional manually.
- Are nested objects supported?
- Yes — nested objects become their own interfaces and arrays are typed by their element type.