json-iterator / go

A high-performance 100% compatible drop-in replacement of "encoding/json"
http://jsoniter.com/migrate-from-go-std.html
MIT License
13.43k stars 1.03k forks source link

Any.ToVal()方法丢失了error #534

Open xczh opened 3 years ago

xczh commented 3 years ago
    api := jsoniter.Config{
        DisallowUnknownFields: true,
    }.Froze()
    any := api.Get([]byte(`{"data":[{"a":1}]}`), "data")
    var data []struct{}
    any.ToVal(&data)
    if err := any.LastError(); err != nil {
        panic(err)
    }

如代码所示,ToVal方法没有返回error,LastError()始终返回nil

请问如何修复?