# JSON to types — TypeScript, Go & Zod, no upload

> Generate TypeScript interfaces, Go structs, or Zod schemas from JSON samples in your browser. Nothing is uploaded — the sample stays in the tab.

Turn a JSON sample into TypeScript interfaces, Go structs, or Zod schemas with recursive inference. Generation happens in the browser, so your sample data isn't uploaded.

Hand-writing types for an API payload is slow and drifts out of sync. Generating them from a real sample gets accurate types instantly — and Zod output gives you runtime validation for free.

The Data Zone has a TypeScript-only variant for data work; for formatting or validating the JSON first, use the JSON toolkit.

## How to

1. **Paste JSON.** Paste a representative JSON sample.
2. **Pick a target.** Choose TypeScript, Go, or Zod.
3. **Copy.** Copy the generated types into your project.

## FAQ

### What outputs are supported?

TypeScript interfaces, Go structs, and Zod schemas, so you can type an API response for your front end, back end, or runtime validation.

### How does it handle nested objects?

It infers recursively, producing nested interfaces/structs and unions where field values vary across samples.

### Is my JSON uploaded?

No. Type generation runs in the browser, so the sample stays on your device.


## Related tools

- [JSON → TypeScript](https://www.safepaper.app/data/json-to-typescript)
- [JSON toolkit](https://www.safepaper.app/dev/json-toolkit)
- [JSON / YAML / TOML](https://www.safepaper.app/dev/data-convert)
- [cURL to code](https://www.safepaper.app/dev/curl-to-code)

---

Canonical HTML: https://www.safepaper.app/dev/json-to-types
Markdown: https://www.safepaper.app/dev/json-to-types.md

There is no upload endpoint — your files are processed in this browser tab. Open your network tab and check.
