Output will appear here
Output will appear here
Convert JSON to Go structs with proper json tags using our free JSON to Go struct generator. The tool infers int, float64, and pointer types automatically, produces idiomatic PascalCase field names, and generates separate struct types for nested objects. A fast way to bootstrap Go data models from any API response.
Try Convert All - paste JSON once, see TypeScript, Go, YAML, and 15 more formats instantly.
Enter a JSON object or array in the input editor. The converter supports deeply nested structures, arrays of objects, and mixed-type fields.
The output pane shows Go structs with exported fields, json struct tags, and inferred types like string, int, float64, bool and time.Time.
Copy the structs to your clipboard or download a .go file you can add directly to your Go package.
A field is typed int only if every sampled value for it is a whole number. If any sample carries a decimal the field widens to float64, so a field seen as 1 in the first record and 1.5 in the thousandth is still float64.
Yes. Every exported field includes a json:"original_key" struct tag so encoding/json will marshal and unmarshal using the original JSON key name, even though Go field names are PascalCase.
A field that is null in some samples becomes a pointer type such as *string, so nil is distinguishable from the zero value. A field that is absent from some objects also becomes a pointer and gains an omitempty tag, so it round-trips as absent. Slices, maps and interface{} are already nil-able and are not wrapped in a second pointer.
Yes. Use the URL-fetch feature to load a JSON response from any public API, and the converter will produce Go structs immediately. This is especially handy when building HTTP clients with net/http.