JSON to Go

Generate Go structs with json:"..." tags from any JSON object.

JSON Input
Go Output

Go structs will appear here

Ready
Paste JSON and generate Go
0
Structs
0
Fields
Free Code Generator

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

  1. Paste your JSON into the input panel.
  2. Set the root struct name and package name.
  3. Optionally enable omitempty or pointer types.
  4. Click Generate Go.
  5. Copy or download the .go file.

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 omitempty in json tags.
  • Optional pointer types for null-capable fields.
  • Download as .go file.

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.