// JSONBytes returns provided JSON response with status code
327375
func JSONBytes(w http.ResponseWriter, status int, b []byte) (err error) {

	w.Header().Set(ContentType, ApplicationJSONCharsetUTF8)
	w.WriteHeader(status)
	_, err = w.Write(b)
	return
}
819300
func (r *Request) JsonBody(instance interface{}) error {
	decoder := json.NewDecoder(r.Body)
	defer r.Body.Close()

	return decoder.Decode(instance)
}
725804
func getJsonBytesFromMap(data map[string]interface{}) ([]byte, error) {
	jsonData, err := json.Marshal(data)
	if err != nil {
		fmt.Println("Invalid data object, can't parse to json:")
		fmt.Println("Error:", err)
		fmt.Println("Data:", data)
		return nil, err
	}
	return jsonData, nil
}
1139962
func (t *Template) RenderBytes(context ...interface{}) ([]byte, error) {
	var b *bytes.Buffer
	err := t.Render(b, context...)
	return b.Bytes(), err
}
377554
func writeJSONBytes(w http.ResponseWriter, data []byte) {
	w.Header().Set("Content-Type", "application/json; charset=utf-8")
	_, err := w.Write(data)
	if err != nil {
		apiLog.Warnf("ResponseWriter.Write error: %v", err)
	}
}
736419
func (c *Client) SendBytes(b []byte) error {
	_, err := c.conn.Write(b)
	return err
}
226680
func (r *Service) GetBytes(key string) ([]byte, error) {
	c := r.pool.Get()
	defer c.Close()
	if err := c.Err(); err != nil {
		return nil, err
	}

	redisVal, err := c.Do("GET", r.Config.Prefix+key)

	if err != nil {
		return nil, err
	}
	if redisVal == nil {
		return nil, ErrKeyNotFound.Format(key)
	}

	return redis.Bytes(redisVal, err)
}
284302
func BytesToJSON(b *[]byte) (*interface{}, error) {
	var container interface{}
	err := json.Unmarshal(*b, &container)

	if err != nil {
		return nil, err
	}

	return &container, nil
}
679049
func JSON(w http.ResponseWriter, status int, i interface{}) error {

	b, err := json.Marshal(i)
	if err != nil {
		return err
	}

	w.Header().Set(ContentType, ApplicationJSONCharsetUTF8)
	w.WriteHeader(status)
	_, err = w.Write(b)

	return err
}
115630
func JSON(w http.ResponseWriter, r *http.Request, v interface{}) {
	buf := &bytes.Buffer{}
	enc := json.NewEncoder(buf)
	enc.SetEscapeHTML(true)
	if err := enc.Encode(v); err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	w.Header().Set("Content-Type", "application/json; charset=utf-8")
	if status, ok := r.Context().Value(StatusCtxKey).(int); ok {
		w.WriteHeader(status)
	}
	w.Write(buf.Bytes())
}
947128
func (v Version) DataBytes(l Level) int {
	vt := &vtab[v]
	lev := &vt.level[l]
	return vt.bytes - lev.nblock*lev.check
}
16443
func (resp *Response) JSONBody(val interface{}) *Response {
	j, err := json.Marshal(val)
	resp.assertion.NotError(err).NotNil(j)

	return resp.Body(j, val)
}
666920
func (c Client) WithBytes(body []byte) Client {
	c.bytes = &body
	return c
}
625869
func (c *Context) JSON(code int, data interface{}) (err error) {
	c.response.Header().Set("Content-Type", "application/json; charset=utf-8")
	c.response.WriteHeader(code)
	if data != nil {
		codec.NewEncoder(c.response, &jh).Encode(data)
	}
	return
}
1312340
func (req *Request) JSONBody(obj interface{}) *Request {
	data, err := json.Marshal(obj)
	req.assertion.NotError(err).NotNil(data)
	return req.Body(data)
}
631056
func (resp *HttpResponse) Json() (json *simplejson.Json) {
	json, _ = simplejson.LoadBytes(resp.Content())
	return
}
408262
func ParseBytes(b []byte) (UUID, error) {
	gu, err := guuid.ParseBytes(b)
	if err == nil {
		return gu[:], nil
	}
	return nil, err
}