JSON to Types

JSON into TypeScript, Zod, or Pydantic.

Runs locally in your browser Report an issue
Generated types

Paste JSON to generate types

Drop in a JSON payload and get TypeScript, Zod, or Pydantic definitions instantly. Everything is inferred in your browser — your data never leaves the page.

Runs entirely in your browser

Generate types from JSON

Paste any JSON payload and get strict types in your target language: TypeScript interfaces, Zod validation schemas (with inferred types), or Python Pydantic models. The tool infers nested object types, names them after their keys, distinguishes integers from floats, unifies the types seen across array elements, and marks a field optional when it is missing from some records. Copy the result straight into your codebase. Your JSON is parsed entirely in your browser and never uploaded.

Common questions

What can it generate?

Three targets: TypeScript interfaces, Zod schemas (plus the z.infer type for each), and Python Pydantic BaseModel classes. Pick the one that matches your stack and copy the output.

How does it handle arrays of objects?

It merges the keys seen across every element into one type: a key present in all elements is required, a key present in only some becomes optional, and differing value types are combined into a union. The element type is named from the singular of the array's key.

Does it tell integers from floats?

Yes. Whole numbers map to number in TypeScript but to z.number().int() in Zod and int in Pydantic; numbers with a decimal map to float. This is inferred from your sample, so include a representative value if a field can be fractional.

What about keys that aren't valid identifiers?

In TypeScript and Zod such keys are quoted. In Pydantic the field is converted to snake_case and the original key is noted as a comment so you can add a Field alias if you need exact round-tripping.

Is my JSON uploaded anywhere?

No. Parsing and code generation run entirely in your browser. The JSON you paste — which may contain real API data — never leaves your device.