Skip to main content
JSON Tools
Popular
Recently added

JSON to TypeScript Converter

Convert JSON into TypeScript interfaces or type aliases in your browser.

Introduction

JSON to TypeScript is useful when you have a sample API response and need a starting type for a client or form model. Nested objects are emitted as separate named interfaces/types so the output stays scannable. Treat the result as a scaffold: refine unions, branded IDs, and optionality once you know how payloads vary in production. Pair it with the JSON Schema Generator when you also need a schema for validation.

Features

  • Interface or type alias output
  • Named types for nested objects
  • Optional and readonly property toggles
  • Root name, indentation, and semicolon options
  • Format, copy, and download .ts

How to use

  • 1
    Paste a representative JSON sample (or load the example).
  • 2
    Choose interface vs type, root name, and formatting options.
  • 3
    Copy or download the generated TypeScript and refine as needed.

Example

Nested object

Input
{"name":"Ali","age":32,"address":{"city":"Islamabad"}}
Output
interface Root {
  name: string;
  age: number;
  address: Address;
}

interface Address {
  city: string;
}

Benefits

  • Use JSON to TS without installing a desktop app or browser extension.
  • Works well alongside JSON Schema and JSON Formatter for adjacent steps in the same workflow.
  • Results stay in this browser tab until you copy or download them.

FAQs

Not from a single sample. Turn on Optional properties if you want every field marked optional, or edit the output after comparing multiple payloads.

Empty arrays become unknown[]. Prefer a sample that includes at least one item so item types can be inferred.

Nested objects are promoted to named interfaces/types (for example Address) so the root type stays readable.

No. Conversion runs entirely in your browser.


Developer resources