BRev Free Tools
At BRev Digital, essentials should be a right — free, forever.
Open in workspacekeep several tools open at once
All tools
JSON to types

JSON to TypeScript, Go, Python & more

Paste a JSON sample — or several, or a JSON Schema — and get ready-to-use types: TypeScript interfaces, Zod schemas, Go structs, Python dataclasses, C# classes, plus Rust, Java, Kotlin, Swift, Dart and JSON Schema. Powered by the quicktype engine, running entirely on your device.

Inputpaste JSON samples or a schema — multiple samples merge into one type
Loading the type generator…
Generated typesregenerates as you type
Loading the type generator…

How JSON type inference works

The generator reads your JSON and builds the strictest type that fits every value it saw: objects become interfaces, structs or classes; arrays become typed lists; a value that appears as both a number and a string becomes a union. Repeated string values (like "active" / "inactive") can be promoted to an enum, and ISO 8601 timestamps or UUIDs can map to your language's date and UUID types — both are toggles above.

Why add multiple samples?

One API response rarely shows every field — optional fields are missing, nullable fields happen to be set. Add two or three real responses with Add sample and they merge into a single type: a field present in every sample stays required, and a field that only some samples carry becomes optional. More samples always produce a more honest type.

Nullable is not optional

A field that appears as null in a sample is nullable — it is always present, but its value may be null (string | null). A field that is missing from some samples is optional — it may not exist at all (field?: string). Serializers treat the two very differently, which is why the generator keeps them distinct instead of collapsing both to "maybe".

JSON Schema in, types out

Already have a JSON Schema? Switch the input to JSON Schema and the types are derived from the schema's declared properties, required list and formats instead of being inferred from samples — or pick the JSON Schema output target to go the other way and generate a schema from samples.

Generated on your device with the quicktype engine — nothing is uploaded.