sing/common/json/unmarshal_std.go
2024-07-22 12:02:46 +08:00

13 lines
263 B
Go

//go:build !go1.20 || without_contextjson
package json
import (
"bytes"
)
func UnmarshalDisallowUnknownFields(content []byte, value any) error {
decoder := NewDecoder(bytes.NewReader(content))
decoder.DisallowUnknownFields()
return decoder.Decode(value)
}