JSON to TypeScript Interface Generator
Generate TypeScript interfaces from JSON. Auto type inference, optional fields, union types.
JSON to TypeScript Features
Auto Type Inference
Smart mapping of JSON types to TypeScript.
Optional Fields
Detects fields not present in all objects.
Union Types
Generates union types for mixed-type fields.
Nested Interfaces
Recursive generation for nested objects.
Array Detection
Auto-detects and types arrays correctly.
Client-Side Privacy
All processing in your browser.
Common Use Cases
API Type Definition
Generate types from API response samples.
Mock Data Typing
Create interfaces from mock JSON data.
Code Generation
Quickly scaffold TypeScript types.
Schema Migration
Convert JSON schemas to TypeScript interfaces.
JSON to TypeScript FAQ
How accurate is the type inference?
The tool maps JSON types to their TypeScript equivalents: string→string, number→number, boolean→boolean, null→null, array→Array<T>, object→interface.
When are optional fields generated?
When converting a JSON array, fields that don't appear in every object are marked optional (?) to reflect the real data shape.
How are union types detected?
If the same field has different types across objects (e.g., sometimes string, sometimes number), a union type (string | number) is generated.
Can I rename the generated interface?
Yes, change the Root Interface Name input. Nested interfaces are auto-named based on the property path.
Does it support complex nested structures?
Yes, deeply nested objects generate separate interface definitions with descriptive names, keeping the output clean.