JSON to Go Struct Converter
Paste any JSON and get Go structs instantly — nested types, arrays and optional fields included.
Root type name
Package
JSON input
Go structs
Paste any JSON and get Go structs instantly — nested types, arrays and optional fields included.
Root type name
Package
JSON input
Go structs
In short: A JSON to Go converter reads a JSON document and writes the matching Go struct definitions, complete with json:"…" tags. Nested objects become their own named structs, arrays become slices and nullable or missing fields become pointers with omitempty.
Writing Go structs by hand for every API response is slow and easy to get wrong. This tool infers the types from real data: it merges every item of an array, so a field that is missing from some items is marked optional instead of being silently dropped.
Paste the struct into your package and decode with json.Unmarshal(data, &v). Everything runs locally in your browser — safe for private payloads.
strings → string, whole numbers → int64, decimals → float64, booleans → bool, arrays → []T, objects → named structs and unknown values → interface{}.
Fields that are null or missing from some array items become pointers (*string) and get omitempty so encoding/json can tell "absent" from "zero".
Keys are converted to exported PascalCase field names (first-name → FirstName) and the original key is preserved in the struct tag.
Paste your JSON, set a root type name, and Go structs are generated instantly. Copy the result or download it as a .go file.
Each nested object becomes its own named type and arrays use the element type inferred from all of their items, so arrays of objects are fully typed.
Fields that are null or missing from some array items become pointers (*string) and get omitempty so encoding/json can tell "absent" from "zero".
Copy the structs into your package, then call json.Unmarshal(data, &root) where root is the generated root type. The json tags map each key to its field, including keys that are not valid Go identifiers.
No. Generation runs entirely in your browser — your JSON never leaves your device.
JSON to TypeScript · JSON to JSON Schema · JSON Validator · JSON Formatter
Browse all free JSON tools →