Convert JSON to Go Struct
Paste a JSON payload and get a ready-to-use Go struct with correct field types, nested types, and `json:"..."` tags — automatically gofmt-formatted. Everything runs locally in your browser, so your data is never uploaded to a server.
JSON Source
Go Struct
Ready.
How to use
- Paste your JSON (an object, or an array to infer the element type) into the input panel.
- Click Convert to Go — the struct is generated entirely in your browser.
- Review the inferred field types, nested structs, and json struct tags.
- Copy the gofmt-formatted struct straight into your .go file (it imports nothing beyond encoding/json).
Common use cases
- Typing an external REST or webhook response so you can json.Unmarshal it into a concrete Go struct.
- Scaffolding request/response models for a Go API without hand-writing struct tags.
- Turning a sample config or fixture JSON into a struct for tests, avoiding map[string]interface{} access.
Frequently asked questions
- Does it add json struct tags?
- Yes — every field gets a `json:"originalKey"` tag so Marshal/Unmarshal round-trips your original JSON key names, even when Go exports the field in PascalCase.
- Is the output formatted?
- Yes, the struct is run through gofmt in the browser so it drops straight into your codebase with correct alignment and spacing.
- Is my JSON uploaded anywhere?
- No. The conversion runs 100% client-side via WebAssembly — nothing is sent to a server, which is why it works offline and on sensitive payloads.