JSON to types
A sample in, a type out.
Output
Paste or type above to see the result here.
Your files stay on your device
This tool runs entirely in your browser. What you paste is processed on your device and is never sent to a server, so it is safe to use with tokens, keys and unpublished text.
How it works
- Paste a sample response. One real record is better than a made-up one.
- Choose TypeScript, Go or Zod.
- Name the top-level type, or leave it as Root.
- Copy the result. Read it over — inference from one sample is a first draft, not a specification.
Frequently asked questions
- Does it look at every element of an array, or just the first?
- Every one. [{a:1},{a:1,b:2}] gives b as optional rather than pretending it does not exist, which is the mistake that makes generated types annoying two weeks later.
- What does it do with null?
- Widens rather than narrows. A field that was null once is a field that can be null, so in TypeScript it becomes a union and in Go a pointer. That is nearly always what the API actually does.
- Do repeated objects get one type or many?
- One. Objects with the same field names share a named type, so a list of fifty users produces one User interface rather than fifty.
- Can I trust the output?
- Trust it as a starting point. One sample cannot tell you that a field is an enum, that a number is an integer, or that a string is a date — read it over and tighten it. It saves the typing, not the thinking.
- Is anything sent to a server?
- No. It runs in your browser, so what you paste stays on your computer.
Related tools
{} JSON Formatter Paste JSON, get it indented, minified or validated instantly. Your data stays on this page. ≠ JSON diff What actually changed, as a path. ✓ YAML validator Does it parse — and does it mean what you think? ⇄ Converters CSV to JSON Turn spreadsheet exports into JSON for APIs, scripts and config files, without your data leaving the page.