github.com/s7techlab/cckit@v0.10.5/gateway/raw_json.go (about) 1 package gateway 2 3 import ( 4 "github.com/golang/protobuf/jsonpb" 5 ) 6 7 func (x *RawJson) MarshalJSON() ([]byte, error) { 8 if x.GetValue() == nil { 9 return []byte("null"), nil 10 } 11 12 return x.GetValue(), nil 13 } 14 15 func (x *RawJson) MarshalJSONPB(_ *jsonpb.Marshaler) ([]byte, error) { 16 if x.GetValue() == nil { 17 return []byte("null"), nil 18 } 19 20 return x.GetValue(), nil 21 }