gojay

high performance JSON encoder/decoder with stream API for Golang
git clone git://git.lair.cx/gojay
Log | Files | Refs | README | LICENSE

commit 2c1c12d273d835b9270bdb62ae296366f91bc01d
parent 4c9828d686c0ea439ab0304b6f1c57760cc70e13
Author: Salim Afiune <afiune@chef.io>
Date:   Wed, 22 Aug 2018 20:01:22 +0200

Made Unmarshal() to accept interfaces{}

Signed-off-by: Salim Afiune <afiune@chef.io>

Diffstat:
Mdecode.go | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/decode.go b/decode.go @@ -150,6 +150,12 @@ func Unmarshal(data []byte, v interface{}) error { dec.data = make([]byte, len(data)) copy(dec.data, data) _, err = dec.decodeArray(vt) + case *interface{}: + dec = borrowDecoder(nil, 0) + dec.length = len(data) + dec.data = make([]byte, len(data)) + copy(dec.data, data) + err = dec.decodeInterface(vt) default: return InvalidUnmarshalError(fmt.Sprintf(invalidUnmarshalErrorMsg, reflect.TypeOf(vt).String())) }