rpc: add marshaler for StackParamType

Makes stack output look better, no one cares about numbers.
This commit is contained in:
Roman Khimov 2019-11-26 19:34:57 +03:00
parent d7d7215392
commit d04bc0cbe3

View file

@ -89,6 +89,11 @@ func StackParamTypeFromString(s string) (StackParamType, error) {
} }
} }
// MarshalJSON implements the json.Marshaler interface.
func (t *StackParamType) MarshalJSON() ([]byte, error) {
return []byte(`"` + t.String() + `"`), nil
}
// UnmarshalJSON sets StackParamType from JSON-encoded data. // UnmarshalJSON sets StackParamType from JSON-encoded data.
func (t *StackParamType) UnmarshalJSON(data []byte) (err error) { func (t *StackParamType) UnmarshalJSON(data []byte) (err error) {
var ( var (