MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / unmarshalJSON

Function unmarshalJSON

dgraphapi/json.go:68–75  ·  view source on GitHub ↗

unmarshalJSON unmarshals the given string into a map.

(jsonStr string)

Source from the content-addressed store, hash-verified

66
67// unmarshalJSON unmarshals the given string into a map.
68func unmarshalJSON(jsonStr string) (map[string]interface{}, error) {
69 jsonMap := map[string]interface{}{}
70 err := json.Unmarshal([]byte(jsonStr), &jsonMap)
71 if err != nil {
72 return nil, errors.Errorf("could not unmarshal want JSON: %v", err)
73 }
74 return jsonMap, nil
75}
76
77// diffJSONMaps compares two JSON maps, optionally printing their differences,
78// and returning true if they are equal.

Callers 1

CompareJSONFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected