I have the following JSON response from the Salt-Stack API:
{
"return": [{
"<UUID1>": true,
"<UUID2>": "Minion did not return. [No response]",
"<UUID3>": true,
"<UUID4>": false
}]
}
I usually use a map structure to unmarshall it in Go:
type getMinionsStatusResponse struct {
Returns []map[string]bool `json:"return"`
}
But due to the second row where an error response is returned (in string format) instead of the boolean, I got the following error: json: cannot unmarshal string into Go value of type bool
I wonder how I can marshall this JSON format in Golang using the encoding/json
package?