MarshalToString converts a protocol buffer object to JSON string.
(pb proto.Message)
| 140 | |
| 141 | // MarshalToString converts a protocol buffer object to JSON string. |
| 142 | func (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 | |
| 150 | type int32Slice []int32 |
| 151 |