JSON to Types

Generate TypeScript interfaces, Zod schemas, or Kotlin data classes from sample JSON.

Input
What it does

Turns a sample JSON document into TypeScript interfaces, Zod schemas, or Kotlin data classes. Every element of an array is merged rather than sampled from the first item, so a key that only some records carry comes out optional and a key with two different value types comes out as a union. Nested objects become their own named types, full ISO date-time strings are flagged with a comment, and keys that are not valid identifiers are quoted or given a @SerialName annotation.

How to use it

Paste your JSON, drop a .json file, or pick one from disk. Choose a target and set the name you want for the root type. Turn the nulls option off if you would rather get a required nullable property than an optional one. The generated code appears immediately with a copy button, and your settings live in the URL so you can share the exact output.

Why this one

The well known JSON to TypeScript converter sites are ad walled, cap the payload size, and post your JSON to their servers to do the work. This one runs in your browser, so your files and inputs never leave your device, and it merges the shapes of all array elements instead of only reading the first one, which is where the popular converters quietly lose optional and union fields.

FAQ
How are arrays with mixed objects handled?
The shapes of every element are merged into one type. A key missing from some elements becomes optional, and a key with conflicting value types becomes a union: string | number in TypeScript, z.union in Zod. Kotlin has no structural union, so it falls back to JsonElement with a comment naming the types that were mixed.
Which Zod version does the output target?
Zod v3 syntax, which is also what Zod v4 accepts for these constructs: z.object, z.array, z.union, .optional(), .nullable(), .describe(), and z.infer. Child schemas are always declared before the schema that references them, and each one gets an exported z.infer type.
Is my JSON uploaded anywhere?
No. Parsing and code generation run entirely in your browser, so your files and inputs never leave your device. The page keeps working offline after the first load.