About the JSON to Go Struct
Decoding JSON in Go means writing a struct with exported fields and json tags. Paste a sample response and this tool writes the structs for you: keys become PascalCase fields with the original name in the tag, nested objects become named types, and arrays become slices.
Whole numbers become int64 and decimals float64; null values become interface{} so you can replace them with the right type.
How to use the JSON to Go Struct
- Paste a JSON sample.
- Set the root type name.
- Copy the Go code.
Features
- json tags with original keys
- Nested named structs
- int64 / float64 / bool / string
- Slices of structs
Supported formats
- Plain text
Frequently asked questions
Should I add omitempty?
Add ,omitempty to tags for fields that may be missing when you encode JSON back out.
Is my text sent anywhere?
No. Everything runs in your browser, so nothing you paste is uploaded or stored.