JSON to TypeScript Converter

Convert JSON objects and arrays to TypeScript interfaces or type aliases. Supports nested objects, arrays, optional and readonly properties.

Convert JSON objects and arrays into TypeScript interfaces or type aliases. Handles nested objects, arrays, optional properties, and readonly modifiers.

Generates TypeScript interfaces or type aliases from JSON. Nested objects become separate interfaces. Arrays of objects use a shared item type. All processing is local.

How to Use This Tool

  1. 1

    Paste your JSON

    Enter a JSON object or array. Click "Load Sample" to try with an example user object.

  2. 2

    Configure options

    Set the root type name, choose interface vs type alias, and toggle export, optional, or readonly modifiers.

  3. 3

    Convert

    Click "Convert to TypeScript" to generate type definitions. Nested objects produce separate named interfaces.

  4. 4

    Copy the output

    Review the generated TypeScript code and copy it directly into your project.

Frequently Asked Questions

Does it handle nested objects?
Yes. Each nested object generates its own named interface (e.g., Address, ProjectsItem), keeping your types clean and reusable.
What about arrays?
Arrays of primitives produce typed arrays (e.g., string[]). Arrays of objects generate a shared item interface with an array type alias.
Interface vs type — which should I use?
Interfaces are extendable and preferred for object shapes. Type aliases are more flexible for unions and complex types. Both work for most use cases.
Is my JSON data sent to a server?
No. All conversion happens entirely in your browser. Your data never leaves your device.