MCPcopy
hub / github.com/gogo/protobuf / MarshalToString

Method MarshalToString

jsonpb/jsonpb.go:142–148  ·  view source on GitHub ↗

MarshalToString converts a protocol buffer object to JSON string.

(pb proto.Message)

Source from the content-addressed store, hash-verified

140
141// MarshalToString converts a protocol buffer object to JSON string.
142func (m *Marshaler) MarshalToString(pb proto.Message) (string, error) {
143 var buf bytes.Buffer
144 if err := m.Marshal(&buf, pb); err != nil {
145 return "", err
146 }
147 return buf.String(), nil
148}
149
150type int32Slice []int32
151

Callers 15

TestNidOptNativeJSONFunction · 0.95
TestNinOptNativeJSONFunction · 0.95
TestNidRepNativeJSONFunction · 0.95
TestNinRepNativeJSONFunction · 0.95
TestNidOptStructJSONFunction · 0.95
TestNinOptStructJSONFunction · 0.95
TestNidRepStructJSONFunction · 0.95
TestNinRepStructJSONFunction · 0.95

Implementers 15

Durationtypes/duration.pb.go
FieldMasktypes/field_mask.pb.go
Timestamptypes/timestamp.pb.go
Apitypes/api.pb.go
Methodtypes/api.pb.go
Mixintypes/api.pb.go
Anytypes/any.pb.go
Emptytypes/empty.pb.go
SourceContexttypes/source_context.pb.go
Structtypes/struct.pb.go
Valuetypes/struct.pb.go
ListValuetypes/struct.pb.go

Calls 2

MarshalMethod · 0.95
StringMethod · 0.65

Tested by 15

TestNidOptNativeJSONFunction · 0.76
TestNinOptNativeJSONFunction · 0.76
TestNidRepNativeJSONFunction · 0.76
TestNinRepNativeJSONFunction · 0.76
TestNidOptStructJSONFunction · 0.76
TestNinOptStructJSONFunction · 0.76
TestNidRepStructJSONFunction · 0.76
TestNinRepStructJSONFunction · 0.76