MqttX.Payload.JSON (MqttX v0.7.0)

View Source

JSON payload codec using the built-in Erlang/BEAM JSON encoder.

Uses the native JSON module available in OTP 27+ / Elixir 1.18+.

Usage

{:ok, json} = MqttX.Payload.JSON.encode(%{temp: 25.5})
{:ok, data} = MqttX.Payload.JSON.decode(json)

Note: This module is only available on OTP 27+ where the native JSON module exists.