JSON to TypeScript
Paste a JSON response and get clean, named TypeScript interfaces. Every element of an array is merged, so fields that only appear on some records come out optional rather than silently wrong.
Output appears here as you type.
Runs entirely in your browser. Nothing you paste here is uploaded or stored.
Questions
Is my JSON uploaded anywhere?
No. Inference and code generation run entirely in your browser. Nothing is sent to a server, so pasting a real API response with customer data or internal URLs is safe.
Should I paste one object or an array of them?
An array, whenever you have one. Every element is merged into a single shape, so a field that is missing from some records becomes optional and a field that is sometimes null becomes nullable. One object can only ever tell the generator that everything is required.
How are nested types named?
From the key that contains them, in PascalCase, with array keys singularised - a "users" array of objects produces a "User" interface. Structurally identical shapes collapse onto one type instead of generating dozens of duplicates.
Why did a string field become a union of literals?
Because the value looked like an enum: a small set of distinct values, each seen more than once. Turn off "Infer literal unions" to always emit plain string.
More code generation tools
JSON → Zod
Generate a Zod schema, with formats, enums and optionals already applied.
JSON → JSON Schema
Generate a draft 2020-12 or draft-07 schema with $defs and required arrays.
JSON → Go
Generate Go structs with json tags, pointers for optional fields, and gofmt spacing.
JSON → C#
Generate C# classes or records with nullable annotations and serializer attributes.
JSON → Python
Generate Pydantic models or dataclasses, with aliases and correct field ordering.
JSON → Java
Generate Java records or POJOs with Jackson annotations and correctly boxed types.
JSON → Rust
Generate serde structs with Option, rename attributes and rustfmt spacing.