func ReadJSON(r io.ReadCloser, data interface{}) error {
	defer r.Close()

	b, err := ioutil.ReadAll(r)
	if err != nil {
		return errors.Trace(err)
	}

	err = json.Unmarshal(b, data)
	if err != nil {
		return errors.Trace(err)
	}

	return nil
}
// ReadJSON reads a JSON data from r and then close it.
ReadJSON reads a JSON data from r and then close it.
// ReadJSON reads a JSON data from r and then close it .
func ReadJSON(r io.ReadCloser, data interface{}) error {
	defer r.Close()
	b, err := ioutil.ReadAll(r)
	if err != nil {
		return errors.Trace(err)
	}
	err = json.Unmarshal(b, data)
	if err != nil {
		return errors.Trace(err)
	}
	return nil
}
func ReadJSON ( r io . ReadCloser , data interface { } ) error { defer r . Close ( ) b , err := ioutil . ReadAll ( r ) if err != nil { return errors . Trace ( err ) } err = json . Unmarshal ( b , data ) if err != nil { return errors . Trace ( err ) } return nil }
ReadJSON reads a JSON data from r and then close it.
ReadJSON reads a JSON data from r and then close it .