JSON to TypeScript Converter

Paste your JSON and instantly generate clean TypeScript interfaces or types.

Input JSON

TypeScript Output
Click "Convert" to generate TypeScript...

How It Works

The converter parses your JSON input and recursively walks through each key-value pair. For every object encountered, it creates a TypeScript interface with properties mapped to their inferred types: strings become string, numbers become number, booleans become boolean, arrays become typed arrays, and nested objects generate additional interfaces. Union types are produced when an array contains mixed element types, and null values resolve to null | T intersections. The final output is a complete, ready-to-paste set of interfaces or type aliases.

Frequently Asked Questions

Can this converter handle nested JSON objects?

Yes. The converter recursively processes all levels of nesting. Each nested object becomes its own separate TypeScript interface, and parent interfaces reference them by name, keeping your types clean and reusable.

What happens with arrays containing mixed types?

When an array contains elements of different types (e.g., strings and numbers), the converter generates a union type like (string | number)[] to accurately represent all possible element types.

Is the generated TypeScript code valid and ready to use?

Absolutely. The output is syntactically correct TypeScript that you can copy and paste directly into your project. All interfaces or type aliases follow standard naming conventions and best practices.

Free tools by TUNA — energy supply from vetted manufacturers