JSON to TypeScript
Convert JSON objects to TypeScript interfaces or type aliases. Automatically infers types from your data structure including nested objects and arrays.
JSON Input
TypeScript Output
Enter JSON and click "Generate TypeScript" to create type definitions.
All processing happens in your browser - your data never leaves your device.
About JSON to TypeScript Conversion
This tool analyzes your JSON structure and generates corresponding TypeScript type definitions. It handles nested objects, arrays, and infers appropriate types for each field.
Features
- Nested Objects: Automatically creates separate interfaces for nested objects
- Arrays: Infers array element types, including union types for mixed arrays
- Optional Fields: Marks nullable fields as optional with
? - Safe Keys: Handles property names that need quoting
- PascalCase Names: Converts object keys to proper TypeScript naming conventions
Options
- Interface vs Type: Choose between
interfaceandtypesyntax - Export: Add
exportkeyword for use in modules - Optional Nulls: Mark fields with null values as optional