View Source Protox.JsonMessageEncoder protocol (Protox v1.7.3)

This protocol makes possible to override the JSON encoding of a specific message.

For instance, it's possible to encode Google.Protobuf.Duration as a string rather than an object as required by the JSON encoding specification.

Summary

Types

t()

All the types that implement this protocol.

Functions

The contract of a message encoder.

Types

@type t() :: term()

All the types that implement this protocol.

Functions

Link to this function

encode_message(msg, json_encode)

View Source (since 1.6.0)
@spec encode_message(
  struct(),
  (any() -> iodata())
) :: iodata()

The contract of a message encoder.

  • msg is the protobuf message to encode
  • json_encode is the function to use in the protocol implementation to encode values to JSON