jsonutil
v0.0.0-20180412040528-e521cbda08e3
github.com/koki/json/jsonutil
Documentation
pkg.go.dev ↗Functions
AtPathIn
func AtPathIn(obj interface{}, path []string) (interface{}, error)
ExtendPrefix
func ExtendPrefix(prefix []string, segment string) []string
ExtraneousAnyPaths
func ExtraneousAnyPaths(prefix []string, before interface{}, after interface{}) [][]string
ExtraneousFieldPaths
func ExtraneousFieldPaths(data map[string]interface{}, parsed interface{}) ([][]string, error)
ExtraneousFieldPaths finds paths in "data" that aren't in "parsed" by serializing
"parsed" to a dictionary and recursively comparing its fields to those of "data".
ExtraneousMapPaths
func ExtraneousMapPaths(prefix []string, before map[string]interface{}, after interface{}) [][]string
ExtraneousSlicePaths
func ExtraneousSlicePaths(prefix []string, before []interface{}, after interface{}) [][]string
FieldValIsEmpty
func FieldValIsEmpty(fieldVal interface{}) bool
GetOnlyMapEntry
func GetOnlyMapEntry(obj map[string]interface{}) (string, interface{}, error)
GetOnlyMapEntry get the only entry from a map. Error if the map doesn't contain exactly one entry.
GetStringEntry
func GetStringEntry(obj map[string]interface{}, key string) (string, error)
MarshalMap
func MarshalMap(source interface{}) (map[string]interface{}, error)
UnmarshalMap
func UnmarshalMap(data map[string]interface{}, target interface{}) error
Types
ExtraneousFieldsError
type ExtraneousFieldsError struct {
Paths [][]string
}
ExtraneousFieldsError.Error
func (e *ExtraneousFieldsError) Error() string