Using it
Paste a JSON value, such as an API response, and the types appear as you type. Write as picks TypeScript interfaces or type aliases, Zod schemas (with the TypeScript type inferred from each), Go structs with json tags, or Python dataclasses. Top-level name names the outermost type. The JSON stays in your browser, which matters when the sample is a real response with real data in it.
How the types are worked out
Each object becomes a named type, called after the key it sits under: an orders array holds Order. Arrays merge all their items, so a key that only some items have becomes optional (note?: string), and a key that's null in some items and a string in others becomes nullable. Whole numbers become integers in Zod, Go and Python, since those can tell the difference; TypeScript has one number type.
Types can only be as good as the sample. A field that's always null, or an empty array, says nothing about what it holds, so those come out as null or unknown[] and are worth checking by hand. Paste a few items with every field filled in for the best result.
Go and Python need field names that are valid in the language, so a key like first-name becomes FirstName or first_name, and a Python keyword such as class becomes class_. If two keys end up with the same name, the second gets a number. Go keeps the real key in its json tag, and Python notes it in a comment.
Questions
Interface or type?
For object shapes they're interchangeable in most code. Interfaces can be extended and merged; type aliases can also name unions. Pick whichever your project already uses.
Why does Go use a pointer for some fields?
A *string can be nil, which is how Go tells a missing or null field apart from an empty one. Optional and nullable fields get one, with omitempty on the tag.
Is the JSON sent anywhere?
No. It's read and turned into types by code running on this page.
Sources
- TypeScript Handbook: Object types
- Zod documentation
- Go: encoding/json (struct tags, omitempty)
- Python: dataclasses
Added . Last updated and reviewed . What's new






