Youtilities

JSON to Go Struct

Generate Go structs with json tags from any JSON. Nested structs named, pointers for nullable values.

Runs in your browser. Nothing is uploaded.

Input

Waiting for JSON

Go
Go types appear here.

What this does

Paste JSON and get Go structs with json tags, ready for encoding/json. Nested objects become their own structs; arrays of objects are merged into one struct.

Types

Whole numbers become int64 and decimals float64. A value that is sometimes null becomes a pointer, such as *string. A key missing from some items gets omitempty. Empty arrays and mixed values become any.

Names

Field names are exported PascalCase versions of the keys; the original key lives in the tag, so first-name works as FirstName. Two objects with the same shape share one struct.

All