jsontoolskit.org
JSON and JSON Schema utilities, in the browser
Say hi →

JSON → Go Struct

Go structs with JSON tags · pointer-for-nullable · package config

Paste a JSON sample, get Go struct definitions with JSON tags. Pointer-for-nullable, omitempty tags, configurable package and top-level type name.

Paste JSON.

How to generate Go structs

  1. Paste your JSON sample.
  2. Configure:
    • Top-level type name (default Root).
    • Package (default main).
    • Pointer for nullable — on (*string for optional) / off.
    • JSON tag styleomitempty on / off.
    • Inline anonymous structs vs Named subtypes.
  3. Output appears below. Copy or Download as .go.

FAQ

Should I use omitempty or pointers?

Both — pointers + omitempty is the most flexible combo: zero-value fields are serialized for value types (with omitempty they'd vanish), and pointer fields with omitempty only serialize when set.

Why are my numbers int64?

JSON numbers are double-precision floats — the tool picks int64 for whole numbers, float64 otherwise. If your numbers fit in int32, hand-edit.

Will it work offline?

Yes.