Skip to content
snowkitDev

Turn JSON into types, right in your browser

Paste an API response or any JSON, and get matching TypeScript interfaces, Go structs, Python dataclasses, Zod schemas or JSON Schema.

JSON to types

Paste JSON and pick the language you need.

Download

Nested objects become named types, and fields missing from some items become optional. Paste a sample of JSON and get ready-to-use types for TypeScript, Zod, Go, Python or JSON Schema. It runs in your browser and is free and private.

How to convert JSON to types

  1. Paste your JSON into JSON, or press Try an example.
  2. Choose the output: TypeScript, Zod, Go, Python or JSON Schema.
  3. Read the generated code.
  4. Press Copy code, or Download.

What this tool does

It reads your JSON, works out the type of every value, and writes code that describes that shape. Arrays of objects are merged, so a field that appears in only some items is marked optional, and a field that is sometimes a number and sometimes text becomes a union.

Five outputs

TypeScript interfaces for front-end and Node code. Zod schemas that validate data at runtime and give you the type for free. Go structs with json tags, using pointers for optional fields. Python dataclasses with modern type hints. JSON Schema (draft 2020-12) for validators and API docs.

Tips for better types

  • Use a sample with several items in each array so optional fields are spotted.
  • Include values for fields that are sometimes empty, so the type is not too narrow.
  • Rename the generated root type to something meaningful for your project.
  • Use the output as a starting point, then tighten it by hand, for example by turning text fields into specific allowed values.
  • Check your JSON is valid first with the JSON tools.

Who uses it

Developers working with a new API, students learning how data is shaped, and freelancers connecting a client's system to a website. To describe a tool for an AI model, use the function schema builder.

Privacy

API responses often contain real user data. Here it never leaves your browser: the types are generated on this device.

Questions

How are dates handled?

Strings that look like ISO dates become time.Time in Go and get a date check in Zod and JSON Schema. Other languages keep them as strings.

What if my sample is incomplete?

Types can only describe the data they see. Paste a response with as many fields filled in as possible, or several items in an array, for the most accurate result.

What happens to null values?

A field that is sometimes null becomes a union with null, or an optional field, depending on the language.

Where to next

Carry on with what you just made, still on your device.

More from Snowkit