JSON to TypeScript Converter
Convert JSON data to TypeScript interfaces and types instantly. Supports nested objects, arrays, optional properties, readonly fields, and export modifiers.
Input JSON
TypeScript Output
Paste JSON on the left to generate TypeScript types
JSON to TypeScript Converter
Convert JSON data to TypeScript interfaces and types instantly. Supports nested objects, arrays, optional properties, readonly fields, and export modifiers.
Features
- Instant conversion from JSON to TypeScript interfaces or type aliases
- Handles nested objects, arrays, and mixed types
- Configurable: optional properties, readonly fields, export modifiers
- Smart PascalCase naming for nested interfaces
How to use
- Paste your JSON data or click Sample to load example data.
- Configure options: interface vs type, optional, readonly, export.
- Copy the generated TypeScript code to your clipboard.
Tips & Best Practices
- Paste your code directly or use the file upload feature for larger files.
- The tool preserves your original input — you can always go back and modify it.
- Use the output directly in your IDE or build pipeline.
- Check the formatted output for any warnings or validation messages.
- All processing is client-side, making it safe for proprietary code.
FAQ
Does it handle nested objects?
Yes. Each nested object becomes its own named interface with PascalCase naming derived from the property key.
Can I use type aliases instead of interfaces?
Yes. Toggle the 'Use interface' checkbox off to generate type aliases instead of interfaces.
How are arrays handled?
Arrays are typed based on the first element. Empty arrays become unknown[]. Object arrays generate a separate interface for the item type.
Does it support null values?
Yes. Null values are typed as 'unknown' since the actual type cannot be inferred from null alone.
Is my data sent to a server?
No. All conversion happens locally in your browser. Your JSON data never leaves your device.