JSON to Go
Convert JSON into Go struct types with exported fields, json tags, nested structs and slice typing.
How to use it
- Paste your JSON into the left panel — a sample loads on start.
- Set the root type name; nested structs are named from their field paths.
- The output lists nested structs and puts the root struct at the bottom; copy it into your package.
- Field names are exported (PascalCase) so
encoding/jsoncan see them, with ajson:"original_key"tag each. - Name conflicts get numeric suffixes; tabs match
gofmtlayout.
Common use cases
- API clients — decode a REST payload into structs instead of
map[string]anyguesswork. - Webhook handlers — define a struct for the events a provider sends you.
- Config loading — type a JSON config file and load it with
json.Unmarshal. - Learning Go types — see how JSON shapes map to structs, slices and the
anyescape hatch.
Why it stays private
Conversion is local string work — no upload, no telemetry. It is safe for internal payload shapes and unreleased API designs.
FAQ
Q: How are numbers typed?
A: All JSON numbers become float64, which is what encoding/json uses by default. Change to int or float32 manually where you know the domain.
Q: What happens with mixed or empty arrays?
A: A single element type produces []T; elements of several different types, or an empty array, degrade to []any since the shape cannot be pinned down from the data alone.
Q: Why did my field get a different name than the JSON key? A: Go field names must be exported and valid identifiers, so keys are converted to PascalCase while the original key stays in the json tag — decoding still matches the wire format exactly.
Your data stays on this device
JSON to Go runs 100% locally. Everything you paste or drop is processed by your own browser and never transmitted. Nothing is stored on our servers — close the tab and it is gone.
Nothing you type is sent to a server, logged, or used for analytics. The page works even with your network disconnected after first load.