JSON to TypeScript

Generate TypeScript interfaces, Zod schemas, Go structs, Pydantic models, or JSON Schema from JSON.

Runs in your browser — your data never leaves your device

Frequently Asked Questions

How do I convert JSON to a TypeScript interface?

Paste your JSON on the left. The TypeScript interfaces appear on the right as you type, with one interface per nested object. Copy them or download types.ts.

How are optional fields detected?

When an array contains several objects, they are merged into one type. A key that is missing from some of the objects becomes optional (`field?:` in TypeScript, `.optional()` in Zod, `omitempty` in Go, and `= None` in Pydantic). Turn on "Make every field optional" to mark all fields optional.

How are null values and mixed arrays handled?

A field that is null in the sample is typed as null. If other samples of the same field have values, it becomes a nullable union such as `string | null`. Arrays with mixed values produce a union type, and empty arrays become `unknown[]`.

Which output formats are supported?

TypeScript interfaces or type aliases, Zod schemas with inferred types, Go structs with json tags, Pydantic v2 models (with aliases for keys that are not valid Python names), and JSON Schema draft 2020-12.

Is my JSON uploaded anywhere?

No. The conversion runs entirely in your browser, so your JSON never leaves your device.