JSON to Go Struct Converter
Paste a sample JSON object or array to generate matching Go structs with json tags. Nested objects become their own named structs.
How to use it
Paste a representative JSON sample and click Generate. Field names are converted to exported (capitalized) Go identifiers, with a json:"originalKey" tag so encoding/json still maps to the original key. Types are inferred from the single sample provided.
Frequently Asked Questions
What if an array has mixed element types?
Go has no union types, so a mixed-type slice falls back to []interface{}. A homogeneous array becomes []T.
What about null values?
A null field is typed interface{}, since Go's static types can't represent "string or nothing" without more context than a single sample provides.
What if two nested objects need the same struct name?
If they have an identical shape, the struct is reused. If the shapes differ, the second gets a numeric suffix (e.g. Address2) to avoid a name collision.