package main
import (
"encoding/json"
"fmt"
)
func main() {
pushData := map[string]interface{}{}
aps := map[string]interface{}{
"alert": "you have a incoming call",
"badge": 10,
"content-available" : 22,
}
push := map[string]interface{}{"content-available": 1, "age": 12}
pushData["aps"] = aps
pushData["alert"] = push
jsonStr, err := json.Marshal(pushData)
if err != nil {
fmt.Println("MapToJsonDemo err: ", err)
}
fmt.Println(string(jsonStr))
}