MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / Marshal

Method Marshal

runtime/marshal_jsonpb.go:32–38  ·  view source on GitHub ↗

Marshal marshals "v" into JSON.

(v interface{})

Source from the content-addressed store, hash-verified

30
31// Marshal marshals "v" into JSON.
32func (j *JSONPb) Marshal(v interface{}) ([]byte, error) {
33 var buf bytes.Buffer
34 if err := j.marshalTo(&buf, v); err != nil {
35 return nil, err
36 }
37 return buf.Bytes(), nil
38}
39
40func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error {
41 p, ok := v.(proto.Message)

Callers 6

TestJSONPbMarshalFunction · 0.95
TestJSONPbMarshalFieldsFunction · 0.95
TestJSONPbEncoderFieldsFunction · 0.95
marshalNonProtoFieldMethod · 0.95

Calls 1

marshalToMethod · 0.95

Tested by 5

TestJSONPbMarshalFunction · 0.76
TestJSONPbMarshalFieldsFunction · 0.76
TestJSONPbEncoderFieldsFunction · 0.76