Skip to content
ToolsOnDuty - free online tools
Converters

JSON to TypeScript Converter

Generate TypeScript interfaces from a JSON sample.

Free foreverRuns in your browserNo sign-up
TypeScript interfaces

About the JSON to TypeScript Converter

Generate TypeScript interfaces from a sample JSON object or array, including nested objects.

Paste an API response or config sample and get typed interfaces you can drop straight into your code.

A big time saver when wiring up a typed client for a new endpoint.

Key features

  • Interfaces for nested objects
  • Infers string, number, boolean and array types
  • Open a file or paste your JSON
  • Copy the result instantly

How to use

  1. 1Paste a representative JSON sample.
  2. 2Read the generated TypeScript interfaces.
  3. 3Copy them into your project.

Examples

Object to interface
Input: {"id":1,"name":"Ada"}
Output: export interface Root { id: number; name: string; }

Each key becomes a typed property in the interface.

Nested object
Input: {"user":{"id":1}}
Output: export interface User { id: number; } export interface Root { user: User; }

Nested objects get their own named interface.

Frequently asked questions

How are arrays typed?
The type of the first element is used, so an array of objects produces a typed interface for that object.
What about optional or mixed fields?
Types come from the sample you paste, so include a representative example. Mixed or missing fields may need manual tweaks.
Is my data uploaded?
No. The generation runs entirely in your browser.