Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ProtoJSONMarshal = Marshaller.Marshal ProtoJSONUnmarshal = Marshaller.Unmarshal )
var Marshaller runtime.Marshaler = &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ UseProtoNames: true, }, }
var MarshallerWithDiscard runtime.Marshaler = &runtime.JSONPb{ MarshalOptions: protojson.MarshalOptions{ UseProtoNames: true, }, UnmarshalOptions: protojson.UnmarshalOptions{ DiscardUnknown: true, }, }
MarshallerWithDiscard discards unknown fields. When in doubt, use Marshaller. This should be used very carefully and mostly for temporary purposes.
Functions ¶
func Compact ¶
Compact appends to dst the JSON-encoded src with insignificant space characters elided.
func MarshalIndent ¶
MarshalIndent is like Marshal but applies Indent to format the output. Each JSON element in the output will begin on a new line beginning with prefix followed by one or more copies of indent according to the indentation nesting.
func NewEncoder ¶
NewEncoder returns a new encoder that writes to w.
Types ¶
type RawMessage ¶
type RawMessage stdjson.RawMessage
RawMessage is a raw encoded JSON value. It implements Marshaler and Unmarshaler and can be used to delay JSON decoding or precompute a JSON encoding.
func (RawMessage) MarshalJSON ¶
func (m RawMessage) MarshalJSON() ([]byte, error)
MarshalJSON returns m as the JSON encoding of m.
func (*RawMessage) UnmarshalJSON ¶
func (m *RawMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON sets *m to a copy of data.