mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-03-23 01:41:56 -04:00
14 lines
306 B
Go
14 lines
306 B
Go
package svc
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
)
|
|
|
|
// StrictJSONUnmarshal is a wrapper around json.Unmarshal that returns an error if the json contains unknown fields.
|
|
func StrictJSONUnmarshal(r io.Reader, v interface{}) error {
|
|
dec := json.NewDecoder(r)
|
|
dec.DisallowUnknownFields()
|
|
return dec.Decode(v)
|
|
}
|