// JSON defines the JSON body to match based on a given structure.
174328
func (r *Request) JSON(data interface{}) *Request {
	if r.Header.Get("Content-Type") == "" {
		r.Header.Set("Content-Type", "application/json")
	}
	r.BodyBuffer, r.Error = readAndDecode(data, "json")
	return r
}
619434
func (s shareMesssage) JSON() string {
	s.Status = "success"
	shareMessageBytes, e := json.MarshalIndent(s, "", " ")
	fatalIf(probe.NewError(e), "Failed to marshal into JSON.")

	// JSON encoding escapes ampersand into its unicode character
	// which is not usable directly for share and fails with cloud
	// storage. convert them back so that they are usable.
	shareMessageBytes = bytes.Replace(shareMessageBytes, []byte("\\u0026"), []byte("&"), -1)
	shareMessageBytes = bytes.Replace(shareMessageBytes, []byte("\\u003c"), []byte("<"), -1)
	shareMessageBytes = bytes.Replace(shareMessageBytes, []byte("\\u003e"), []byte(">"), -1)

	return string(shareMessageBytes)
}
296708
func (s makeBucketMessage) JSON() string {
	makeBucketJSONBytes, e := json.MarshalIndent(s, "", " ")
	fatalIf(probe.NewError(e), "Unable to marshal into JSON.")

	return string(makeBucketJSONBytes)
}
675671
func (c *xContext) JSON(i interface{}, codes ...int) (err error) {
	var b []byte
	if c.echo.Debug() {
		b, err = json.MarshalIndent(i, "", "  ")
	} else {
		b, err = json.Marshal(i)
	}
	if err != nil {
		return err
	}
	return c.JSONBlob(b, codes...)
}
401182
func ReadJSONBody(r *http.Request, result interface{}) error {
	err := json.NewDecoder(r.Body).Decode(result)
	r.Body.Close()

	if err != nil {
		return err
	}

	return nil
}
31468
func (c *Context) JSON(code int, v interface{}) error {
	c.Response().Header().Set("Content-Type", "application/json")
	c.Response().WriteHeader(code)
	return json.NewEncoder(c.Response()).Encode(v)
}
886721
func Json(req *http.Request, userStruct FieldMapper) error {
	err := jsonBinder(req, userStruct)
	if len(err) > 0 {
		return err
	}

	return nil
}
16443
func (resp *Response) JSONBody(val interface{}) *Response {
	j, err := json.Marshal(val)
	resp.assertion.NotError(err).NotNil(j)

	return resp.Body(j, val)
}
958099
func JSON(in string) (map[string]interface{}, error) {
	obj := make(map[string]interface{})
	out, err := unmarshalObj(obj, in, yaml.Unmarshal)
	if err != nil {
		return out, err
	}

	_, ok := out[ejsonJson.PublicKeyField]
	if ok {
		out, err = decryptEJSON(in)
	}
	return out, err
}
976524
func (s policyRules) JSON() string {
	policyJSONBytes, e := json.MarshalIndent(s, "", " ")
	fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
	return string(policyJSONBytes)
}
984302
func (app *App) JSON(route string, handler interface{}) *App {
	h := app.defaultRouter.determineHandler(handler)
	app.defaultRouter.Handle(MethodGET, route, jsonHandler(h))

	return app
}
723433
func (s *IndicesPutMappingService) BodyJson(mapping map[string]interface{}) *IndicesPutMappingService {
	s.bodyJson = mapping
	return s
}
1131800
func (c *Context) JSON(code int, i interface{}) (err error) {
	b, err := json.Marshal(i)
	if err != nil {
		return err
	}
	c.Writer.Header().Set("Content-Type", "application/json; charset=utf-8")
	c.Writer.WriteHeader(code)
	c.Writer.Write(b)
	return
}
141047
func (wc *WebhookContext) JSON(out interface{}) error {
	var err error
	if wc.body == nil {
		wc.firstParse = true
		wc.body, err = ioutil.ReadAll(wc.gin.Request.Body)

		if err != nil {
			return err
		}
	}
	err = json.Unmarshal(wc.body, out)

	if err != nil && strings.HasPrefix(string(wc.body), "payload=") {
		s := string(wc.body)
		s, err = uurl.QueryUnescape(s[8:])
		if err != nil {
			return err
		}
		err = json.Unmarshal([]byte(s), out)

	}
	return err
}
532392
func (ctx *Context) JSON(obj interface{}) {
	json, err := json.Marshal(obj)
	if err != nil {
		panic(err)
	}
	ctx.SetHeader("Content-Type", "application/json")
	ctx.Send(json)
}
504267
func (s *JSONSchema) JSON() ([]byte, error) {
	if s.Ref == "" {
		s.Schema = SchemaRef
	}
	return json.Marshal(s)
}
836246
func (d diffMessage) JSON() string {
	d.Status = "success"
	diffJSONBytes, e := json.MarshalIndent(d, "", " ")
	fatalIf(probe.NewError(e),
		"Unable to marshal diff message `"+d.FirstURL+"`, `"+d.SecondURL+"` and `"+string(d.Diff)+"`.")
	return string(diffJSONBytes)
}