// ToJson returns the map that marshals from the body bytes as json in response .
// it calls Response inner.
197296
func (b *HttpRequest) ToJson(v interface{}) error {
	data, err := b.Bytes()
	if err != nil {
		return err
	}
	return json.Unmarshal(data, v)
}
1362454
func (m Mapping) MarshalJSON() ([]byte, error) {
	data := map[string]interface{}{m.Name: m.Entries}
	return json.Marshal(data)
}
403983
func FlattenJson(jsonBytes []byte) (map[string][]string, error) {
	jsonMap := make(map[string]interface{})
	if err := json.Unmarshal(jsonBytes, &jsonMap); err != nil {
		return nil, err
	}
	return FlattenJsonMap(jsonMap)
}
425078
func (r *Response) MarshalJSON() ([]byte, error) {
	return []byte(r.res), r.err
}
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
}
1155772
func (o *OvsMap) UnmarshalJSON(b []byte) (err error) {
	var oMap []interface{}
	o.GoMap = make(map[interface{}]interface{})
	if err := json.Unmarshal(b, &oMap); err == nil && len(oMap) > 1 {
		innerSlice := oMap[1].([]interface{})
		for _, val := range innerSlice {
			f := val.([]interface{})
			o.GoMap[f[0]] = f[1]
		}
	}
	return err
}
684311
func (m ConcurrentMap) MarshalJSON() ([]byte, error) {
	// Create a temporary map, which will hold all item spread across shards.
	tmp := make(map[string]interface{})

	// Insert items to temporary map.
	for item := range m.IterBuffered() {
		tmp[item.Key] = item.Val
	}
	return json.Marshal(tmp)
}
1184935
func ToJson(v interface{}) string { // nolint
	data, err := json.Marshal(v)
	if err != nil {
		// Swallow errors inside of a template.
		return ""
	}
	return string(data)
}
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
}
914377
func (resp *QueryResponse) MarshalJSON() ([]byte, error) {
	if resp.Err != nil {
		return json.Marshal(struct {
			Err string `json:"error"`
		}{Err: resp.Err.Error()})
	}

	return json.Marshal(struct {
		Results        []interface{}    `json:"results"`
		ColumnAttrSets []*ColumnAttrSet `json:"columnAttrs,omitempty"`
	}{
		Results:        resp.Results,
		ColumnAttrSets: resp.ColumnAttrSets,
	})
}
640792
func ToJson(rdr io.Reader, recast ...bool) (string, error) {
	var r bool
	if len(recast) == 1 {
		r = recast[0]
	}
	m, merr := ToMap(rdr, r)
	if m == nil || merr != nil {
		return "", merr
	}

	b, berr := json.Marshal(m)
	if berr != nil {
		return "", berr
	}

	return string(b), nil
}
863696
func (ps *PeerState) ToJSON() ([]byte, error) {
	ps.mtx.Lock()
	defer ps.mtx.Unlock()

	return cdc.MarshalJSON(ps)
}
973891
func (re encodable) MarshalJSON() ([]byte, error) {
	return Encode(re.e, re.obj)
}
323622
func (t String) MarshalJSON() ([]byte, error) {
	return json.Marshal(map[string]interface{}{
		"type": t.typeMarker(),
	})
}
327550
func (e *httpError) MarshalJSON() ([]byte, error) {

	if len(e.data) == 0 {
		return json.Marshal(e.msg)
	}

	innerErr := withFieldsE(nil, "", nil)
	for k, v := range e.data {
		if k != "status" {
			innerErr.data[k] = v
		}
	}

	var innerInnerErr error
	switch len(innerErr.data) {
	case 0:
		innerErr = nil
	case 1:
		var err error
		for _, v := range innerErr.data {
			if tErr, ok := v.(error); ok {
				err = tErr
				break
			}
		}
		if err != nil {
			innerInnerErr = err
		}
	}

	jsonError := struct {
		Message string `json:"message"`
		Status  int    `json:"status"`
		Inner   error  `json:"error,omitempty"`
	}{
		Message: e.msg,
		Status:  e.Status(),
		Inner:   innerErr,
	}

	if innerInnerErr != nil {
		jsonError.Inner = innerInnerErr
	}

	return json.Marshal(jsonError)
}
1299016
func (r *Response) DecodeJSON(out interface{}) error {
	return jsonutil.DecodeJSONFromReader(r.Body, out)
}
12588
func (r *Resp) ToJSON(v interface{}) error {
	data, err := r.ToBytes()
	if err != nil {
		return err
	}
	return json.Unmarshal(data, v)
}