json.Unmarshal

The Go function that decodes JSON bytes into a Go value you pass by pointer, such as &reply.

In more detail

Fields are matched to keys through struct tags or by name. Syntax errors and type mismatches return an error; unknown keys are ignored unless you use a Decoder with DisallowUnknownFields. Decode into typed structs so the rest of the code gets checked values.

Example

err := json.Unmarshal(data, &reply)

Related terms

Taught in

References