JSON to Go Struct Converter

type AutoGenerated struct {
	Id int `json:"id"`
	Name string `json:"name"`
	Active bool `json:"active"`
	Score float64 `json:"score"`
	Roles []string `json:"roles"`
	Profile Profile `json:"profile"`
	Posts []Post `json:"posts"`
}

type Profile struct {
	Bio interface{} `json:"bio"`
	Website string `json:"website"`
}

type Post struct {
	Title string `json:"title"`
	Views int `json:"views"`
	Pinned bool `json:"pinned,omitempty"`
}
Converted locally in your browser. Your JSON stays only on this page.

Turn a JSON sample into Go structs

Paste an example API response or config object and get Go struct declarations with json:"..." tags to unmarshal into. Nested objects become their own named structs, arrays of objects are merged into one element struct where keys missing from some items get an ,omitempty tag, empty or mixed arrays become []interface, and the top-level type is named AutoGenerated.

When to use this tool

Use it to scaffold Go structs from a sample payload — paste an API response, fixture, or config object and get typed struct declarations with json tags to unmarshal into.

Privacy and limitations

Conversion runs locally in your browser with JSON.parse, so payloads never leave the page. Types are inferred from one sample: omitempty tags, slice element types, and struct names reflect only the values you paste, so review them before committing.