Conditions | 3 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | package mollie |
||
13 | func (cv *ContextValues) UnmarshalJSON(data []byte) error { |
||
14 | var d map[TransactionType]ContextValue |
||
15 | |||
16 | if err := json.Unmarshal(data, &d); err != nil { |
||
17 | if _, ok := err.(*json.UnmarshalTypeError); ok { |
||
18 | *cv = make(ContextValues) |
||
19 | |||
20 | return nil |
||
21 | } |
||
22 | |||
23 | return err |
||
24 | } |
||
25 | |||
26 | *cv = ContextValues(d) |
||
27 | |||
28 | return nil |
||
29 | } |
||
30 |