1
0
mirror of https://github.com/json-iterator/go.git synced 2025-01-08 13:06:29 +02:00
json-iterator/jsoniter_adapter.go

15 lines
217 B
Go
Raw Normal View History

2016-12-04 16:50:53 +02:00
package jsoniter
2016-12-05 07:20:27 +02:00
import "io"
2016-12-04 16:50:53 +02:00
// adapt to json/encoding api
func Unmarshal(data []byte, v interface{}) error {
iter := ParseBytes(data)
iter.Read(v)
2016-12-05 07:20:27 +02:00
if iter.Error == io.EOF {
return nil
}
2016-12-04 16:50:53 +02:00
return iter.Error
}