Paste an API response and get a Go struct with json tags to unmarshal it
Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 16 Oct 2026.Unmarshalling an API response in Go needs a struct whose fields carry json tags, and typing one by hand for a large response is slow and easy to get wrong. Paste the response and get a single struct with the nested objects written inline, ready for json.Unmarshal. Whole numbers become int, decimals float64, and keys missing from some items get omitempty.
Paste or type your input.
Choose the options you need.
Press Ctrl+Enter, then copy or download.
Go decodes JSON into structs, and every field needs the right type and a json:"..." tag naming the key. This converter writes those types from a sample, so a 200-line API response becomes correct Go in one paste.
| JSON value | Go type |
|---|---|
| "text" | string |
| true / false | bool |
| 42 (whole numbers only) | int, or int64 beyond 32 bits |
| 4.5 (any decimal seen) | float64 |
| null, and also a type | a pointer, such as *string |
| only null, or mixed kinds | any |
| [ ... ] | a slice, such as []string |
| { ... } | a named struct, or an inline one |
Every output was checked by reading the Go back and decoding the sample with encoding/json's rules. Nothing you paste leaves the browser.
The rest of the article, and all 6 questions about JSON to Go Struct Converter, are on the JSON to Go Struct Converter page.
Paste a JSON sample into the converter and the Go struct appears beside it, with a json tag on every field and nested objects as their own types. Copy it into your package and decode with json.Unmarshal(data, &v), where v is a variable of the root type.
With omitempty, json.Marshal leaves the field out when it holds the zero value: an empty string, 0, false, nil or an empty slice. The converter adds it to keys missing from some objects of an array, and a switch adds it to every field.
Go style, checked by golint and most linters, writes initialisms in capitals: ID, URL, HTTP, API, JSON and about forty more. The json tag keeps the original key, user_id or userId, so decoding still matches the API exactly.
No. The conversion runs in your browser with no request to any server, and the JSON is not stored, so API responses holding tokens or personal data stay on your device. Close the tab and nothing remains.
Rates and rules change; check the source before you rely on a figure.
Still stuck? Ask about JSON to Go Struct Converter and anybody who knows can answer. No account needed.
Same job, other tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · JSON to YAML – Turn JSON into clean, readable YAML for configs · Query String Parser – Split a URL query string into a table of decoded parameters.