Free JSON to Go struct — json tags · omitempty · pointers

Convert JSON to Go
struct. json tags,
omitempty, pointers.

Generate Go structs with json tags from any JSON sample. Nested structs, pointer types for nullable fields, omitempty options. Includes json.Unmarshal snippets. Runs entirely in your browser.

Your data never leaves your browser
json tags generated
Nested structs
Pointer types for nullable
Always free
JSON to Go Struct Generator   100% client-side
Use a representative JSON sample with non-null values where possible. Null fields become *interface{} — or pointer types if enabled.
JSON input
  Go struct ready

      
How JSON types map to Go types

The type inference rules applied to each JSON value.

JSON valueGo typeWith pointer option
"Alice"stringstring
42intint
98.5float64float64
trueboolbool
nullinterface{}*string / *int…
["a","b"][]string[]string
[{…},{…}][]ChildStruct[]ChildStruct
{…}ChildStructChildStruct
When do you need JSON to Go structs?
REST API clients

When calling a REST API in Go, you need structs that match the response JSON for json.Unmarshal. Generate from a real API response sample and use immediately with http.Get + json.NewDecoder(resp.Body).Decode(&result). The json tags ensure field name mapping even when the API uses snake_case and your Go code uses PascalCase.

HTTP handler response types

Go HTTP handlers use json.Marshal or json.NewEncoder to write JSON responses. Define the response struct first — generate it from a sample, then implement the handler. Using explicit structs instead of map[string]interface{} gives you compile-time field checking and IDE autocomplete.

Config file parsing

Go applications often read configuration from JSON files. Generate the config struct from your JSON config sample — then use json.NewDecoder(f).Decode(&cfg) to load it. With pointer types enabled, optional config fields default to nil and you can check if they were set with if cfg.Field != nil.

Cloud and DevOps tooling

Go is the language of cloud-native tooling — Kubernetes controllers, Terraform providers, Docker plugins. These tools heavily use JSON/YAML APIs with complex nested structures. Generate struct definitions from the API spec JSON samples to accelerate development of controllers and operators.

Popular searches
json to go struct json to golang struct json to go convert json to go struct json to go struct online json to go struct generator json golang struct json to golang struct online json to go struct converter go struct from json

Go structs generated
in your browser. No upload.

The entire struct generation runs in JavaScript locally. Your JSON is never transmitted to any server. The generated code follows Go conventions: PascalCase field names, correct json tags matching the original JSON key, and the encoding/json package patterns used throughout the Go standard library.

The output is immediately usable with encoding/json — json.Unmarshal([]byte(data), &result) without any additional configuration. For HTTP responses: json.NewDecoder(resp.Body).Decode(&result).

Proper json tags
Every field gets a json tag matching the original JSON key — handles camelCase, snake_case and any other naming convention.
Pointer types for null
Optional: use *string, *int instead of interface{} for nullable fields — lets you distinguish null from zero value in Go.
Nested structs
Nested JSON objects become separate named structs or inline anonymous structs — both patterns supported.
47 tools, always free
No file size limits, no watermarks, no account. Funded by non-intrusive display advertising only.
Frequently asked questions
Common questions about generating Go structs from JSON.
How do I convert JSON to a Go struct?
Paste your JSON sample, set the struct name, choose your options, and click Generate. The output is a complete Go struct definition with json tags. Copy it into your Go file and use json.Unmarshal([]byte(jsonString), &myStruct) to deserialize.
What are json tags and why do I need them?
Json tags tell the encoding/json package how to map struct field names to JSON keys. Without tags, Go uses the exact field name — so a Go field Name maps to "Name" in JSON, not "name". With a json tag like `json:"name"`, it maps correctly. Tags also support omitempty (skip zero-value fields) and - (exclude field entirely).
How do I unmarshal JSON into a Go struct?
Use json.Unmarshal: var obj MyStruct; err := json.Unmarshal([]byte(jsonStr), &obj); if err != nil { log.Fatal(err) }. For HTTP responses: err := json.NewDecoder(resp.Body).Decode(&obj). Always pass a pointer to the struct.
When should I use pointer types in Go JSON structs?
Use pointer types (*string, *int) when a JSON field can be null or absent — a nil pointer represents null/missing, while a zero-value string "" represents an empty string. This distinction matters for PATCH endpoints where you need to know which fields were explicitly sent. Enable Pointer for nullable in the options above.
Is the JSON to Go converter free?
Yes, completely free. No file size limits, no account required. JSONshift is funded by non-intrusive display advertising.
Go up