MCPcopy
hub / github.com/golang/protobuf / Marshaler

Struct Marshaler

jsonpb/encode.go:30–51  ·  view source on GitHub ↗

Marshaler is a configurable object for marshaling protocol buffer messages to the specified JSON representation.

Source from the content-addressed store, hash-verified

28// Marshaler is a configurable object for marshaling protocol buffer messages
29// to the specified JSON representation.
30type Marshaler struct {
31 // OrigName specifies whether to use the original protobuf name for fields.
32 OrigName bool
33
34 // EnumsAsInts specifies whether to render enum values as integers,
35 // as opposed to string values.
36 EnumsAsInts bool
37
38 // EmitDefaults specifies whether to render fields with zero values.
39 EmitDefaults bool
40
41 // Indent controls whether the output is compact or not.
42 // If empty, the output is compact JSON. Otherwise, every JSON object
43 // entry and JSON array value will be on its own line.
44 // Each line will be preceded by repeated copies of Indent, where the
45 // number of copies is the current indentation depth.
46 Indent string
47
48 // AnyResolver is used to resolve the google.protobuf.Any well-known type.
49 // If unset, the global registry is used by default.
50 AnyResolver AnyResolver
51}
52
53// JSONPBMarshaler is implemented by protobuf messages that customize the
54// way they are marshaled to JSON. Messages that implement this should also

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected