‹ Back ✦ AI Chat
{}→Go

JSON to Go Struct

Generate Go structs with json tags from a JSON sample.

Runs entirely in your browser. Nothing is sent anywhere.

How it works

  1. 1Paste or type your text.
  2. 2Choose the options you need.
  3. 3Copy or download the result.

About this tool

JSON to Go Struct: Generate Go structs with json tags from a JSON sample. Paste your text and the result appears immediately, ready to copy or download. Everything happens locally in your browser — nothing you paste is uploaded or stored.

Example

Input

{
  "id": 42,
  "name": "Ana Silva",
  "email": "ana@example.com",
  "active": true,
  "score": 9.5,
  "tags": ["admin", "editor"],
  "address": { "city": "Lisbon", "zip": "1100-148" },
  "orders": [
    { "order_id": 1, "total": 19.99, "note": null },
    { "order_id": 2, "total": 5, "coupon": "SPRING" }
  ]
}

Output

type Root struct {
	ID      int64    `json:"id"`
	Name    string   `json:"name"`
	Email   string   `json:"email"`
	Active  bool     `json:"active"`
	Score   float64  `json:"score"`
	Tags    []string `json:"tags"`
	Address Address  `json:"address"`
	Orders  []Order  `json:"orders"`
}

type Address struct {
	City string `json:"city"`
	Zip  string `json:"zip"`
}

type Order struct {
	OrderID int64       `json:"order_id"`
	Total   float64     `json:"total"`
	Note    interface{} `json:"note,omitempty"`
	Coupon  *string     `json:"coupon,omitempty"`
}
How do I use the JSON to Go Struct?

Paste or type your text. Choose the options you need. Copy or download the result.

Is the JSON to Go Struct free?

Yes. It is completely free with no sign-up, no usage limits and no watermark.

Is my data sent to a server?

No. Everything is calculated locally in your browser. Nothing you enter is uploaded, logged or stored.

Does it work on my phone?

Yes. It works in any modern browser on Android, iPhone, iPad, Windows, Mac and Linux — no app needed.