UnmarshalJSON unmarshals the given string into a map.
(t *testing.T, jsonStr string)
| 39 | |
| 40 | // UnmarshalJSON unmarshals the given string into a map. |
| 41 | func UnmarshalJSON(t *testing.T, jsonStr string) map[string]interface{} { |
| 42 | jsonMap := map[string]interface{}{} |
| 43 | err := json.Unmarshal([]byte(jsonStr), &jsonMap) |
| 44 | if err != nil { |
| 45 | t.Fatalf("Could not unmarshal want JSON: %v", err) |
| 46 | } |
| 47 | |
| 48 | return jsonMap |
| 49 | } |
| 50 | |
| 51 | // DiffJSONMaps compares two JSON maps, optionally printing their differences, |
| 52 | // and returning true if they are equal. |