JSON to TypeScript

Convert JSON objects to TypeScript type definitions, interfaces, or classes automatically.

About JSON to TypeScript

Automatically generate TypeScript interfaces from JSON data. The converter infers types from values: strings become string, numbers become number (or number for floats), booleans become boolean, arrays become Array or T[], nested objects become separate interfaces, and null values become Type | null. This saves time when working with API responses — paste the JSON, get the TypeScript interface, add it to your codebase.

FAQ

How are null values handled?
Null values in JSON are mapped to nullable/optional types in the target language. In TypeScript: field: Type | null. In Go: *Type (pointer). In Python: Optional[Type]. In Java: Optional or @Nullable annotation. If a field is null in your sample JSON, consider providing a more complete sample where the field has a real value so the type can be accurately inferred.