JSON encoding in Go
JSON encoding converts Go values into JSON data that can be sent or stored, while JSON decoding converts JSON data into Go values. The encoding/json package provides Encoder, Decoder, Marshal, and Unmarshal for these operations.
Minimal example
type Response struct {
Message string `json:"message"`
}
func main() {
data, _ := json.Marshal(Response{Message: "ok"})
fmt.Println(string(data))
}