diff --git a/notification.go b/notification.go index 09abe0d5..69bf312d 100644 --- a/notification.go +++ b/notification.go @@ -137,12 +137,12 @@ type Notification struct { // MarshalJSON converts the notification payload to JSON. func (n *Notification) MarshalJSON() ([]byte, error) { - switch n.Payload.(type) { + switch payload := n.Payload.(type) { case string: - return []byte(n.Payload.(string)), nil + return []byte(payload), nil case []byte: - return n.Payload.([]byte), nil + return payload, nil default: - return json.Marshal(n.Payload) + return json.Marshal(payload) } }