b94ea975f3
Marshalling a Code to JSON and unmarshalling it failed with an "invalid code" error message. Code is of type uint32. It has no custom MarshalJson() implemented therefore it is marshalled into an JSON integer value. The UnmarshalJSON() function expected that the marshalled Code is a String type, unmarshalling failed. Check in UnmarshalJSON() if the value is an uint32 in the range of the defined Code values. If it is, unmarshal it. This commit also adds an Marshal/Unmarshal testcase. |
||
---|---|---|
.. | ||
code_string.go | ||
codes.go | ||
codes_test.go |