New blogMaking an AI Agent You Can Trust With Money

★ Paste the API response. Get the types.

JSON to Types Converter

Paste JSON, get clean types for TypeScript, Zod, Pydantic, Go, Rust, JSON Schema, Prisma or GraphQL. Optional keys, nulls and nested objects are inferred from every sample, not just the first.

  • Runs in your browser
  • No signup

Strictness

Your JSON

TypeScript

3 types · 16 fields
export interface Root {
  id: number;
  email: string; // email
  "display-name": string;
  createdAt: string; // date-time
  plan: null;
  tags: string[];
  team: Team;
  invoices: Invoice[];
}

export interface Invoice {
  number: string;
  amount: number;
  paid: boolean;
  paidAt: string | null; // date-time
  note?: string;
}

export interface Team {
  id: string; // uuid
  name: string;
  website: string; // url
}

Typing APIs by hand?

I set up end-to-end type safety (DB → API → UI) so this never happens again.

Fix my types
01

Pick your language

02

How the inference works

Most converters look at the first object and stop. This one walks the whole document and merges every sample it finds, which is what makes the output safe to trust:

every array element → merged into one shape
key missing in some elements → optional
key sometimes null → nullable (T | null)
1 and 1.5 in the same key → number, not integer
identical nested objects → one shared type

String formats are detected too: ISO timestamps, dates, emails, UUIDs and URLs become the richest type the target supports, like datetime in Pydantic or .email() in Zod.

03

Worked example

A user record with a nested team, a list of invoices (one missing a note, one with a null payment date) and an awkward display-name key:

{
  "id": 1042,
  "email": "ada@example.com",
  "display-name": "Ada",
  "createdAt": "2026-11-07T09:30:00Z",
  "plan": null,
  "tags": ["beta", "founder"],
  "team": {
    "id": "7f3c9a2e-1b4d-4c8e-9f2a-6d5e4c3b2a19",
    "name": "Analytical Engines",
    "website": "https://example.com"
  },
  "invoices": [
    { "number": "INV-001", "amount": 49.5, "paid": true, "paidAt": "2026-10-01T00:00:00Z" },
    { "number": "INV-002", "amount": 49, "paid": false, "paidAt": null, "note": "Card declined" }
  ]
}

Becomes this TypeScript, generated by the same engine that runs the converter above (3 types, 16 fields):

export interface Root {
  id: number;
  email: string; // email
  "display-name": string;
  createdAt: string; // date-time
  plan: null;
  tags: string[];
  team: Team;
  invoices: Invoice[];
}

export interface Invoice {
  number: string;
  amount: number;
  paid: boolean;
  paidAt: string | null; // date-time
  note?: string;
}

export interface Team {
  id: string; // uuid
  name: string;
  website: string; // url
}
04

Questions developers actually ask

Is my JSON sent to a server?
No. Parsing and type generation run in your browser, so you can paste real API responses with tokens or customer data. Nothing leaves the tab.
How does it know a field is optional?
Paste an array of objects, or a response that contains one. Every element is read and merged: keys missing from some elements become optional, and keys that are sometimes null become nullable.
Why did two nested objects become one type?
Objects with exactly the same keys and value types are deduplicated into one named type, so billing and shipping addresses share an Address-style type instead of two copies.
Is the output production-ready?
It is a strong first draft. Review the names, tighten types where you know more than the sample shows (enums, ID sizes, date handling), and paste several samples for better optional detection.
How big can the JSON be?
A few megabytes is fine. Conversion runs on every edit after a short pause, so very large payloads may feel sluggish on older laptops.
05

Every target

06

More from the workbench

Fine print

Tools: on the house.
Engineer: by the hour.

A codebase that doesn't need this tool is the upgrade. I set up end-to-end type safety so your API, database and UI agree by construction.

I'm Himanshu, an AI and full-stack engineer. I build MVPs, AI agents and the growth plumbing around them for early-stage startups.