JSON to Go
Generate Go structs with json:"..." tags from any JSON object.
Go structs will appear here
JSON to Go Struct Generator
Paste any JSON object and instantly generate clean Go struct definitions with proper json:"fieldName" tags. Choose optional omitempty tags and pointer types for nullable values — all running locally in your browser.
How to generate Go from JSON
- Paste your JSON into the input panel.
- Set the root struct name and package name.
- Optionally enable
omitemptyor pointer types. - Click Generate Go.
- Copy or download the
.gofile.
Features
- Generates Go structs with exported PascalCase field names.
- Adds
json:"fieldName"tags automatically. - Type mapping: string, int, float64, bool, interface{}, []T, nested struct.
- Optional
omitemptyin json tags. - Optional pointer types for null-capable fields.
- Download as
.gofile.
Frequently Asked Questions
What Go types are used?
JSON string → string, JSON integer → int, JSON decimal → float64, JSON boolean → bool, JSON null → interface{} (or pointer type), JSON array → []T, JSON object → a new struct.
What are json tags used for?
Go's encoding/json package uses struct field tags to map between Go field names (PascalCase) and JSON key names (usually camelCase). The tag json:"name" tells the encoder/decoder to use "name" as the JSON key.
Is my JSON sent to a server?
No. All generation runs entirely in your browser. Your JSON never leaves your device.