unmarshalJSON unmarshals the given string into a map.
(jsonStr string)
| 66 | |
| 67 | // unmarshalJSON unmarshals the given string into a map. |
| 68 | func 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. |