JSON to Go
Paste JSON and instantly get matching Go struct definitions with nested types, slices, and json tags.
JSON Input
Go Struct
Anonymous nested structs are generated in place, the same shape gofmt would produce.
Copied!
Summary
Paste JSON and instantly get matching Go struct definitions with nested types, slices, and json tags.
How it works
- Paste JSON into the input box, or click "Load Sample" to try it with example data.
- Set a root struct name and, optionally, a package name.
- The Go struct definition renders on the right as you type.
- Nested objects become nested structs; arrays of objects merge their fields into one struct.
- Click "Copy Go Code" to copy the generated struct to your clipboard.
Use cases
- Bootstrap Go structs for a REST API client from a sample response.
- Type a webhook payload before writing the handler.
- Generate structs from third-party API documentation JSON.
- Check how encoding/json will map a JSON shape before writing code by hand.
- Speed up prototyping Go services that consume external JSON.
Frequently Asked Questions
Last updated: 2026-07-23 ·
Reviewed by Nham Vu