go.pennock.tech/swallowjson (go): Package swallowjson provides a utility function for implementing the encoding/json.Unmarshaler interface's UnmarshalJSON method to decode, without discarding unknown keys.  The "swallow" concept says that any keys in a JSON object which do not correspond to a known field in a (Golang) struct should not be discarded but instead put into a map.  The struct field to swallow fields not explicitly named must be a map keyed by string.  The type of map values is handled reliably, returning a JSON error if unsuitable. Common types to use might be `interface{}` or `json.RawMessage`.  Errors are either of type swallowjson.SwallowError or are bubbled through from the json or reflect packages.
Keywords: encoding|golang|json|json-fields|reflect|swallow