About JSON to Go (Golang) Struct
This tool reads a JSON object and generates matching Go (Golang) struct definitions — with exported (capitalized) field names and json:"..." struct tags on every field, so encoding/json can correctly map each field back to its original JSON key. Nested objects become their own separate struct types, and arrays are typed as Go slices. Paste a sample API response and get ready-to-use struct definitions in seconds. All processing happens locally in your browser; your data is never uploaded to a server.
How Type Inference Works (and Its Limits)
This tool infers Go types purely from the JSON values you provide. Whole numbers become int and decimals become float64. Since Go's struct fields must be capitalized ("exported") for the encoding/json package to see them via reflection, every field name is converted to PascalCase — the JSON tag (e.g. json:"first_name") preserves the original key so encoding and decoding still work correctly against your real API. When a field isn't present in every element of an array in your sample, its tag gets ,omitempty added, following the standard Go convention for optional fields. Since Go has no union type, a field that holds different types across array items falls back to interface{}. As with any code generated from a single example, it's worth reviewing the result against your actual API contract before using it in production.
Send Feedback
For any questions, bug reports, or feature requests, please use the form below to send us a message.