I have a database sql.NullBool. To unmarshal json into it, I am writing this little function. I can converty the byte array to string by simply casting it (string(data))...not so for bool. Any idea how I can convert to bool?
type NullBool struct {
sql.NullBool
}
func (b *NullBool) UnmarshalJSON(data []byte) error {
b.Bool = bool(data) //BREAKS!!
b.Valid = true
return nil
}