Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
package main
import (
"encoding/json"
"fmt"
)
type ServiceDescriptionPayload struct {
Address string `json:"address"`
}
type ServiceDescription struct {
Action string `json:"action"`
Payload ServiceDescriptionPayload `json:"payload"`
}
func main() {
publicIP := "8.8.8.8"
serviceDescription, err := json.Marshal(ServiceDescription{
Action: "write",
Payload: ServiceDescriptionPayload{
Address: publicIP,
},
})
if err != nil {
// ...
}
fmt.Println(serviceDescription)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.