func MyHandler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() requestBody := &MyRequestBody{} if err := json.NewDecoder(r.Body).Decode(requestBody); err != nil { http.Error(w, "bad request", http.StatusBadRequest) return } ctx = context.WithValue(ctx, "my-request-body", requestBody) r = r.WithContext(ctx) // do request handling } func MiddlewareExample() http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { logger := log.New(os.Stdout, "", log.LstdFlags) ctx := r.Context() logger.Printf("received request for %s", r.URL.Path) requestBody := &ApiRequestBody{} if err := json.NewDecoder(r.Body).Decode(requestBody); err != nil { http.Error(w, "bad request", http.StatusBadRequest) return } ctx = context.WithValue(ctx, "api-request-body", requestBody) r = r.WithContext(ctx) // Call the next handler in the chain. h.ServeHTTP(w, r) }) }In conclusion, the `Context` JSON middleware from `github.com/grafana/grafana/pkg/middleware` is an essential package for handling HTTP request and response JSON serialization and deserialization. It's widely used in Go development and plays a significant role in the Grafana monitoring platform.