JSON to Go Struct
Paste a JSON sample to get Go structs: field names are exported while the wire spelling is kept in a json tag, nested objects become named structs, arrays become slices, and a field that shows two different types falls back to any with a note so you look at it. Numbers follow int64 and float64, and the whole result lands in one file you can drop into a package.
How to use
Generate exported Go structs with json tags from a JSON sample. Your data is processed only inside this browser tab.
FAQ
Why wrap keys in json tags?
encoding/json only fills exported fields, so the field name goes idiomatic while the tag preserves the real payload key.
What happens to a field with two types?
It becomes any and is listed in the note above the output, because that usually means the sample is incomplete.
Related tools
JSON Formatter
Beautify, minify and validate JSON right in your browser. No uploads, nothing leaves your device.
PopularRegex Tester
Live matches, capture groups and a replace preview for JavaScript regex.
PopularJSON to CSV
Flatten a JSON array into CSV, nested keys becoming columns.
JSON ⇄ XML Converter
Convert between JSON and XML in both directions.
JWT Decoder
Read a JSON Web Token's header and claims — signature not verified.
JSON Diff
Compare two JSON documents by path, with added, missing and changed values.