JSON to Go Struct

Generate Go structs with JSON tags from JSON data in your browser.

Generate Go structs with JSON tags from objects, arrays, and nested JSON fields.

How to use

  1. Paste valid JSON.
  2. Generate the Go struct.
  3. Review field names and types before copying.

Examples

Object to Go struct

Input

{"id":1,"name":"demo"}

Output

type Root struct {
	Id int64 `json:"id"`
	Name string `json:"name"`
}
Privacy
May contact server Avoid sensitive data Uploads only when needed

Conversion runs locally in your browser and does not upload JSON.

Frequently asked questions

JSON does not define integer widths, and int64 covers more common values by default.

An empty array becomes []any because its element type cannot be inferred.
Next steps

Related tools

After finishing this task, continue with these related tools.