Peregrine falcon logoPeregrine Dev

JSON to TypeScript — Generate Types from JSON Free

Paste your JSON and get TypeScript interfaces or types instantly. No sign-up required.

How to json to typescript

  1. 1.Paste your JSON data into the input text area
  2. 2.Optionally set the root type name, output mode (interface or type), and property modifiers
  3. 3.Click 'Convert' to generate TypeScript definitions
  4. 4.Click 'Copy' to copy the generated types to your clipboard

About This Tool

A JSON to TypeScript converter takes raw JSON data and produces TypeScript interface or type alias definitions that describe the shape of that data. This is useful when you receive JSON from an API and want to create type-safe code without manually writing every interface by hand.

This free JSON to TypeScript tool recursively walks your JSON structure, generating a named interface or type for every nested object. Arrays are analyzed to determine whether all elements share the same type or require a union. You can customise the root type name, choose between interface and type output, and toggle optional or readonly modifiers on every property.

All processing happens locally in your browser. Your JSON is never sent to any server, making this JSON to TypeScript converter safe for API responses containing tokens, credentials, or other sensitive data. There are no usage limits, no account requirements, and no ads.

Frequently Asked Questions

Yes. The converter recursively walks your JSON and generates a separate interface or type for every nested object. Each nested type is named using PascalCase derived from its JSON key, and the root type references them by name.

If every element in an array is the same type, the output uses that type followed by []. If elements are mixed types, it produces a union array such as (string | number)[]. Empty arrays are typed as unknown[]. Arrays of objects merge all object shapes into a single interface.

TypeScript interfaces use the 'interface' keyword and can be extended or merged. Type aliases use the 'type' keyword and are more flexible for unions and intersections. Both are valid ways to define object shapes; the choice is largely a matter of project convention.

Yes. Toggle the 'Optional properties' checkbox to add a ? to every property, making them all optional. Toggle 'Readonly properties' to prepend the readonly modifier to each property, preventing reassignment in TypeScript.

No. All conversion happens locally in your browser. Your data is never transmitted to any server and is not stored or logged in any way.

Related Tools