UnmarshalJSON implements the json.Unmarshaler interface.
(data []byte)
| 138 | |
| 139 | // UnmarshalJSON implements the json.Unmarshaler interface. |
| 140 | func (h *Hash) UnmarshalJSON(data []byte) (err error) { |
| 141 | var s string |
| 142 | if err = json.Unmarshal(data, &s); err != nil { |
| 143 | return |
| 144 | } |
| 145 | if err = Decode(h, s); err != nil { |
| 146 | return |
| 147 | } |
| 148 | return nil |
| 149 | } |
| 150 | |
| 151 | // MarshalYAML implements the yaml.Marshaler interface. |
| 152 | func (h Hash) MarshalYAML() (interface{}, error) { |