package encoding import ( "encoding/json" "io" ) type decoder struct { r io.Reader } func NewDecoder(r io.Reader) Decoder { return &decoder{r} } func (d *decoder) Decode(v interface{}) (err error) { return json.NewDecoder(d.r).Decode(&v) }