package serializer import ( "github.com/gogo/protobuf/jsonpb" "google.golang.org/protobuf/runtime/protoiface" ) // ProtobufToJSON converts protocol buffer message to JSON string func ProtobufToJSON(message protoiface.MessageV1) (string, error) { marshaler := jsonpb.Marshaler{ EnumsAsInts: false, EmitDefaults: true, Indent: " ", OrigName: true, } return marshaler.MarshalToString(message) }