JSON to TypeScript
Paste JSON, get TypeScript interfaces or types. Handles nested objects, arrays, and nullable fields. 100% client-side — your data never leaves the browser.
How JSON to TypeScript Works
Automatic Type Inference
Analyzes JSON values and infers TypeScript types: string, number, boolean, null. Nested objects become separate interfaces.
Array Detection
Detects array element types automatically. Mixed-type arrays become union types. Empty arrays default to unknown[].
Configurable Output
Choose interface vs type alias, add optional markers, readonly modifiers, and export keywords. Customize the root type name.
Frequently Asked Questions
Is this JSON to TypeScript converter free?▾
Yes, completely free with no signup required. Convert JSON to TypeScript interfaces or types unlimited times. Everything runs in your browser.
Does it handle nested objects and arrays?▾
Yes. Nested objects are extracted as separate TypeScript interfaces. Arrays are automatically typed based on their elements, including mixed-type arrays that become union types.
What's the difference between interface and type?▾
TypeScript interfaces support declaration merging and can be extended. Type aliases are more flexible and support unions, intersections, and mapped types. Both work well — choose based on your coding style.
Can I add optional or readonly modifiers?▾
Yes. Toggle optional (?) to mark all fields as optional, or readonly to make all fields immutable. You can also add export keywords and customize the root type name.
Is my JSON data safe?▾
Absolutely. Everything runs 100% in your browser — your JSON data never leaves your device. No server requests, no data collection. Verify in your browser's Network tab.
How does it handle null values?▾
Null values are typed as `null`. If a field can be null, the type becomes a union like `string | null`. This ensures type safety when working with nullable data.