JSON to TypeScript Types
Paste JSON, get TypeScript interfaces, type aliases, Zod schemas, or Valibot schemas. Updates as you type.
interface Root {
id: number;
user: RootUser;
active: boolean;
createdAt: string;
}
interface RootUser {
name: string;
email: string;
tags: string[];
}01 — Overview
How it works
Convert any JSON sample into a TypeScript type definition or runtime schema. Toggle between interface, type alias, Zod, and Valibot output. Configure root name, optional fields, readonly modifiers, and how to handle nulls. Powered by quicktype.
02 — Use cases
When to use it
- 01
Generate types for a third-party API you only have a sample response from
- 02
Bootstrap a Zod schema from a JSON fixture
- 03
Convert an inherited JSON blob into proper TypeScript before refactoring
- 04
Add runtime validation to a route that previously trusted unknown input
03 — Examples
Real input, real output
{ "id": 1, "name": "Alex", "active": true }
ex 01interface Root { id: number; name: string; active: boolean; }
Basic interface inferred from a single sample.
{ "items": [{ "id": "a" }, { "id": "b", "label": "B" }] }
ex 02interface Root { items: Item[]; } interface Item { id: string; label?: string; }
Array items are merged and fields present in only some objects become optional.
{ "id": 1, "name": "Alex" } // Zod output
ex 03z.object({ id: z.number(), name: z.string() })
Same shape as a Zod schema for runtime validation.
04 — FAQ
Frequently asked
05 — More
Tools that pair well
JWT Encoder & Decoder
Decode any JWT and inspect its header, payload, and signature. Encode new tokens with HS256, RS256, and more.
Regex Generator
Describe what you want to match in plain English. Get a regex pattern with a live test panel and a token-by-token breakdown.
UUID Generator
Generate UUIDs (v1, v4, v7, v8) in bulk, with format options and a validator. Cryptographically random by default.