Documentation
¶
Overview ¶
Package jsonpb implements a JSON <> Protocol Buffer marshaler that supports more protocol buffer options thatn the default stdlib JSON marshaler.
Index ¶
- type JSONPb
- func (j *JSONPb) ContentTypes() []string
- func (j *JSONPb) Exts() []string
- func (j *JSONPb) Marshal(v any) ([]byte, error)
- func (j *JSONPb) Marshals(v any) bool
- func (j *JSONPb) Name() string
- func (j *JSONPb) NewDecoder(r io.Reader) codecs.Decoder
- func (j *JSONPb) NewEncoder(w io.Writer) codecs.Encoder
- func (j *JSONPb) Unmarshal(b []byte, v any) error
- func (j *JSONPb) Unmarshals(v any) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONPb ¶
type JSONPb struct{}
JSONPb wraps Google's implementation of a JSON <> Protocol buffer marshaller that has more extented support for protocol buffer fields.
func (*JSONPb) ContentTypes ¶
ContentTypes returns the content types the marshaller can handle.
func (*JSONPb) Marshal ¶ added in v0.2.0
Marshal marshals any object into json bytes. Param v should be a pointer type.
func (*JSONPb) Marshals ¶ added in v0.2.0
Marshals returns if this is able to encode the given type.
func (*JSONPb) NewDecoder ¶
NewDecoder returns a new JSON/ProtocolBuffer decoder.
func (*JSONPb) NewEncoder ¶
NewEncoder returns a new JSON/ProtocolBuffer encoder.
func (*JSONPb) Unmarshal ¶ added in v0.2.0
Unmarshal decodes json bytes into object v. Param v should be a pointer type.
func (*JSONPb) Unmarshals ¶ added in v0.2.0
Unmarshals returns if this is able to decode the given type.