How to use Go Struct Tag Builder
Paste your input on the left, choose the options you want, and the output appears instantly on the right. Everything runs in your browser — none of your data is sent to a server.
- Paste or type your input in the
INPUTpanel - The output regenerates automatically as you type
- Use
Copyto put the result in your clipboard - Click
Sampleto load a working example
What is Go Struct Tag Builder?
Paste a JSON sample to generate a Go struct with proper field names (PascalCase) and customizable tags (json, yaml, xml, db, gorm, validate, form, bson). Choose between snake_case, kebab-case, or as-is tag values, with optional omitempty. Saves hours when defining domain models from API responses. This tool is part of santekno's developer toolbox — a curated collection of utilities built for engineers who care about speed, privacy, and simplicity.
Common use cases
- Debugging API payloads and integration issues
- Inspecting tokens, hashes, or encoded strings during development
- Generating fixtures and sample data for tests
- Sharing readable output with teammates in code reviews
FAQ
Go requires exported fields (capitalized) to be marshaled by encoding/json and similar packages.
JSON conventions vary: REST APIs typically use snake_case or camelCase. YAML/HTTP headers often use kebab-case. Match what your API or library expects.
Use omitempty when zero values should be omitted from output (e.g. optional API fields). Be careful: it omits 0, false, empty strings — use a pointer if you need to distinguish.
Nested objects are inferred as map[string]any in this tool. For a strongly-typed nested struct, use the JSON to Go Struct tool which generates nested types.
GORM tags follow the format gorm:"primaryKey;column:user_id;type:uuid". Use the form-based builder to add specific GORM annotations.