★ 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
Convert to
Strictness
Your JSON
TypeScript
3 types · 16 fieldsexport 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.
Pick your language
- .tsJSON to TypeScriptConvert JSON to TypeScript interfaces or types.
- .tsJSON to ZodConvert JSON to Zod schemas with inferred TypeScript types.
- .pyJSON to PydanticConvert JSON to Pydantic v2 models.
- .goJSON to Go structConvert JSON to Go structs with json tags, omitempty for optional fields, pointers for nullable ones and Go initialisms like ID and URL.
- .rsJSON to Rust (serde)Convert JSON to Rust structs with serde derives, Option for nullable and optional fields, snake_case names and rename attributes.
- .jsonJSON to JSON SchemaGenerate JSON Schema (draft 2020-12) from a JSON sample: required keys, nullable types, formats and $defs for nested objects.
- .prismaJSON to PrismaConvert JSON to Prisma models: scalar mapping, @id detection, @map for awkward keys and Json fields for nested data.
- .graphqlJSON to GraphQLConvert JSON to GraphQL type definitions with non-null markers, ID detection and DateTime and JSON scalars.
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:
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.
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
}
Questions developers actually ask
Is my JSON sent to a server?
How does it know a field is optional?
Why did two nested objects become one type?
Is the output production-ready?
How big can the JSON be?
Every target
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.
