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

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.

Link to this section Summary

Functions

The contract of a message encoder.

Link to this section Types

Link to this section Functions

Link to this function

encode_message(msg, json_encode)

View Source (since 1.6.0)

Specs

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