// JSON takes an object, marshals it and make it avaiable for POST and PUT.
13023
func (c *EzClient) JSON(j interface{}) *EzClient {
	b, err := json.Marshal(j)
	if err == nil {
		c.body = bytes.NewReader(b)
	}

	return c
}
863293
func (m *marshalableError) MarshalJSON() ([]byte, error) {
	return json.Marshal(m.err.Error())
}
501668
func (m Map) JSON() (string, error) {
	for k, v := range m {
		m[k] = cleanUp(v)
	}

	result, err := json.Marshal(m)
	if err != nil {
		err = errors.New("objx: JSON encode failed with: " + err.Error())
	}
	return string(result), err
}
68691
func (ctx *Context) JSON(v interface{}) error {
	ctx.SetContentType(jsonCT)
	b, err := ctx.ToJSON(v)
	if err != nil {
		return err
	}

	_, err = ctx.Write(b)
	return err
}
973891
func (re encodable) MarshalJSON() ([]byte, error) {
	return Encode(re.e, re.obj)
}
1148361
func (t Version) JSON() (output string, err error) {
	var raw []byte
	ver := Get()
	if raw, err = json.MarshalIndent(ver, "", "\t"); err != nil {
		return
	}
	return string(raw), nil
}
1300799
func (packet *Packet) JSON() ([]byte, error) {
	packetJSON, err := json.Marshal(packet)
	if err != nil {
		return nil, err
	}

	interfaces := make(map[string]Interface, len(packet.Interfaces))
	for _, inter := range packet.Interfaces {
		if inter != nil {
			interfaces[inter.Class()] = inter
		}
	}

	if len(interfaces) > 0 {
		interfaceJSON, err := json.Marshal(interfaces)
		if err != nil {
			return nil, err
		}
		packetJSON[len(packetJSON)-1] = ','
		packetJSON = append(packetJSON, interfaceJSON[1:]...)
	}

	return packetJSON, nil
}
1001201
func (r rmMessage) JSON() string {
	msgBytes, e := json.MarshalIndent(r, "", " ")
	fatalIf(probe.NewError(e), "Unable to marshal into JSON.")
	return string(msgBytes)
}
796606
func (c contentMessage) JSON() string {
	c.Status = "success"
	jsonMessageBytes, e := json.MarshalIndent(c, "", " ")
	fatalIf(probe.NewError(e), "Unable to marshal into JSON.")

	return string(jsonMessageBytes)
}
1278043
func JSON(expected, actual []byte) *Result {
	var expectedInterface, actualInterface interface{}
	if len(expected) > 0 {
		if err := json.Unmarshal(expected, &expectedInterface); err != nil {
			return &Result{err: fmt.Sprintf("failed to unmarshal expected value: %s", err)}
		}
	}
	if len(actual) > 0 {
		if err := json.Unmarshal(actual, &actualInterface); err != nil {
			return &Result{err: fmt.Sprintf("failed to unmarshal actual value: %s", err)}
		}
	}
	return AsJSON(expectedInterface, actualInterface)
}
524657
func (this BSON) JSON() (string, error) {
	m, err := this.Map()
	if err != nil {
		return "", err
	}
	j, err := json.Marshal(m)
	if err != nil {
		return "", err
	}
	return string(j), nil
}
951072
func MarshalJSON(errobj error) ([]byte, error) {
	errjson, err := newJSON(1, errobj)
	if errjson == nil || err != nil {
		return []byte(""), err
	}
	return json.Marshal(errjson)
}
296708
func (s makeBucketMessage) JSON() string {
	makeBucketJSONBytes, e := json.MarshalIndent(s, "", " ")
	fatalIf(probe.NewError(e), "Unable to marshal into JSON.")

	return string(makeBucketJSONBytes)
}
1300516
func WriteJSON(w http.ResponseWriter, obj interface{}) error {
	writeContentType(w, jsonContentType)
	jsonBytes, err := json.Marshal(obj)
	if err != nil {
		return err
	}
	_, err = w.Write(jsonBytes)
	return err
}
1288296
func SetJSON(s interface{}) (string, error) {
	dat, err := json.Marshal(s)
	return string(dat), err
}
672396
func (ctx *Context) JSON(obj interface{}) *Context {
	data, err := json.Marshal(obj)
	if err == nil {
		fmt.Fprint(ctx.Writer(), string(data))
	}
	return ctx
}
140053
func (c copyMessage) JSON() string {
	c.Status = "success"
	copyMessageBytes, e := json.MarshalIndent(c, "", " ")
	fatalIf(probe.NewError(e), "Failed to marshal copy message.")

	return string(copyMessageBytes)
}