-
pb.json.Options.base64 and pb.json.Base64: the base64 codec for bytes
fields, four functions and no state. The default is pb.json.base64_std,
which is std's scalar codec. A caller with large payloads passes a vectorized
one, such as stdx.base64.
-
pb.map(n): marks a repeated entry message as a map<K, V>. The binary
encoding does not change; JSON writes it as one object instead of a list of
entries, which is what the protobuf JSON mapping requires.
-
pb.json: encode, decode, and decodeLeaky, the proto3 JSON mapping over
the same Descriptor table. 64-bit integers are strings, bytes is base64,
an enum is its case name, a field name is lowerCamelCase in the output and
both spellings are accepted in the input. An unknown key is
error.UnknownField unless Options.ignore_unknown_fields is set.
-
pb.wkt: Timestamp, Duration, the nine wrapper types, FieldMask, and
Empty, each with the JSON form that the mapping gives it: an RFC 3339
string, "3.5s", a bare value, a comma-separated path list, and {}.
Any, Struct, Value, and ListValue are not included.
-
pb.oneof() and pb.Variants(T): a oneof is a ?U field where U is a
union(enum) with a case table. Each case has its own field number, a decode
keeps the last case on the wire, and a case set to its zero value is still
written.
-
pb.Unknown: a struct field of this type keeps every field the table does
not declare, and encode writes them back after the declared fields. A
known field number with a wire type the field does not take is kept too. The
field is not part of Descriptor(T).
-
pb.delimited: encode, writeBytes, and Reader, the varint length prefix
that separates back-to-back messages on one stream. Frame.fields bounds a
field reader to one message, and Frame.rest returns the whole frame.