// MarshalJSON implements the encoding/json Marshaler interface. It will encode
// b into its base64 representation if valid, or 'null' otherwise.
MarshalJSON implements the encoding/json Marshaler interface. It will encode
b into its base64 representation if valid, or 'null' otherwise.
// MarshalJSON implements the encoding / json Marshaler interface . It will encode // b into its base64 representation if valid or ' null ' otherwise .
func (b ByteSlice) MarshalJSON() ([]byte, error) {
	if !b.Valid {
		return []byte("null"), nil
	}
	return json.Marshal(b.ByteSlice)
}
func ( b ByteSlice ) MarshalJSON ( ) ( [ ] byte , error ) { if ! b . Valid { return [ ] byte ( " " ) , nil } return json . Marshal ( b . ByteSlice ) }
MarshalJSON implements the encoding/json Marshaler interface.
MarshalJSON implements the encoding / json Marshaler interface .
// Because we're passing a []byte into json.Marshal, the json package will // handle any base64 decoding that needs to happen.