Payloads and formatting#
MQTT message payloads are arbitrary bytes. MQTT.fx helps you make sense of them: it decodes received payloads for display, lets you format and save them, and provides editors for building payloads to publish. Decoding and editing can be extended with add-ons.
Decoding received payloads#
When you select a received message (on the Subscribe tab or in the Namespace Explorer), the Payload decoded with selector chooses how the payload is rendered. Your choice is remembered per profile, so a profile keeps using the decoder you picked.
Payload decoders are discovered as add-ons (see below). The default decoder is plain text. For an MQTT 5 message that carries a Content Type, MQTT.fx can match a decoder to that MIME type. In the Namespace Explorer, JSON and Eclipse Sparkplug payloads are auto-detected and pretty-printed.
Quick-view formats in the message details#
The message details pane also offers fixed quick-view buttons that re-render the selected payload as:
- Plain — plain text
- JSON — formatted JSON
- Hex — hexadecimal
- Base64 — Base64
These are independent of the chosen decoder and are handy for a fast look at a payload in a different representation.
Saving payloads#
From a received message you can save the payload to a file via Save Payload:
- ... as Raw (binary) — the exact bytes
- ... as Text (plain)
- ... as JSON (formatted)
- ... as Hex
- ... as Base64
You can also Copy Payload to put the payload on the clipboard.
Tip: when you need to keep a payload exactly as received (for example binary or Sparkplug data), use Save as Raw — the text/JSON/hex/Base64 forms are representations for reading, not byte-for-byte copies of binary content.
Editing payloads for publishing#
On the Publish tab you type the payload directly into the message area. For structured payloads, a Payload Editor can build the content for you and place the result into the message area (and set the topic). The editor list is populated from installed editor add-ons; pick one and open it from the publish toolbar.
For MQTT 5 publishes you can also set the Content Type and Payload Format Indicator alongside the payload — see MQTT 5 features.
Payload add-ons#
Payload decoders and editors are loaded as add-ons. MQTT.fx ships a built-in set (via the de.jensd:mqttfx-payload-decoders library) and additionally discovers add-ons placed in the addons folder of the MQTT.fx working directory (see the Appendix).
You can review the installed decoders and editors — with their name, version, and description — under About → Add-ons.
Building your own#
You can write your own payload decoders and editors and drop them into the addons folder. The reference projects on GitHub show the interfaces to implement and how to package an add-on:
- Payload decoders: github.com/Jerady/mqttfx-payload-decoders
- Payload editors: github.com/Jerady/mqttfx-addon-payload-editors
Payload display size#
The font size used for payloads can be tuned in Settings — either a dynamically scaled size or a fixed size. This is useful when payloads are large or when you want denser output.