func (ns NullString) MarshalJSON() ([]byte, error) {
if !ns.Valid {
return []byte("null"), nil
}
return json.Marshal(ns.String)
}
It would render `user_id: null` instead of `user_id: ""` which should work, I think.