func (a APS) MarshalJSON() ([]byte, error) {
	return json.Marshal(a.Map())
}
MarshalJSON allows you to json.Marshal(aps) directly.
package payload
import (
	"encoding/json"
	"github.com/RobotsAndPencils/buford/payload/badge"
)
type APS struct {
	Alert Alert
	Badge badge.Badge
	Sound string
	ContentAvailable bool
	Category string
	MutableContent bool
	ThreadID string
}
type Alert struct {
	Title        string   `json:"title,omitempty"`
	TitleLocKey  string   `json:"title-loc-key,omitempty"`
	TitleLocArgs []string `json:"title-loc-args,omitempty"`
	Subtitle string `json:"subtitle,omitempty"`
	Body    string   `json:"body,omitempty"`
	LocKey  string   `json:"loc-key,omitempty"`
	LocArgs []string `json:"loc-args,omitempty"`
	ActionLocKey string `json:"action-loc-key,omitempty"`
	LaunchImage string `json:"launch-image,omitempty"`
}
func (a *Alert) isSimple() bool {
	return len(a.Title) == 0 && len(a.Subtitle) == 0 &&
		len(a.LaunchImage) == 0 &&
		len(a.TitleLocKey) == 0 && len(a.TitleLocArgs) == 0 &&
		len(a.LocKey) == 0 && len(a.LocArgs) == 0 && len(a.ActionLocKey) == 0
}
func (a *Alert) isZero() bool {
	return len(a.Body) == 0 && a.isSimple()
}
func (a *APS) Map() map[string]interface{} {
	aps := make(map[string]interface{}, 5)
	if !a.Alert.isZero() {
		if a.Alert.isSimple() {
			aps["alert"] = a.Alert.Body
		} else {
			aps["alert"] = a.Alert
		}
	}
	if n, ok := a.Badge.Number(); ok {
		aps["badge"] = n
	}
	if a.Sound != "" {
		aps["sound"] = a.Sound
	}
	if a.ContentAvailable {
		aps["content-available"] = 1
	}
	if a.Category != "" {
		aps["category"] = a.Category
	}
	if a.MutableContent {
		aps["mutable-content"] = 1
	}
	if a.ThreadID != "" {
		aps["thread-id"] = a.ThreadID
	}
	return map[string]interface{}{"aps": aps}
}