Go code
—
Types are inferred from the first array element and the values present. Empty arrays become []interface{}, null becomes interface{}, and json tags keep the original field names.
About the JSON to Go
The JSON to Go Converter generates Go struct definitions from sample data. It infers field types, creates nested structs, adds json tags for the original key names, and names the root type after your input.
Generated structs are a starting point, not a schema. Rename fields to match your domain, add validation tags, and check nullable fields before using the types in production.
- ✓Nested struct generation
- ✓Int and float64 inference
- ✓json tags on every field
How to use the JSON to Go
- 1
Paste a JSON sample.
- 2
Set the root type name.
- 3
Generate and copy the Go code.
Frequently asked questions
Why is a field interface{}?+
The value was null, so the tool cannot infer a concrete type. Replace interface{} with the real type from your API contract.
How are arrays typed?+
The type comes from the first element. Mixed arrays need a manual union or a common interface in Go.
Save JSON to Go to your favorites, or keep browsing developer tools.
Browse all 35 developer tools →