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)On runtimes without the native JSON module, encode/1 and decode/1
return {:error, :json_not_available} instead of raising
UndefinedFunctionError (mirroring MqttX.Payload.Protobuf's graceful
degradation).