Payload formatters allow you to process data going to and from end devices. This is useful for converting binary payloads to human readable fields, or for doing any other kind of data conversion on uplinks and downlinks.
This section explains how to set up payload formatters for a specific end device or an entire application.
In addition to the written instructions linked below, a video with instructions for creating JavaScript and device repository payload formatters is available on The Things Network YouTube channel.
Show video
Types of Payload Formatters
The Things Stack supports three types of payload formatters: JavaScript, CayenneLPP, and Repository payload formatters.
JavaScript
The Things Stack allows you to write your own custom payload formatters in JavaScript. To find out how to write a custom JavaScript payload formatter, see the JavaScript Payload Formatters section.
CayeneLPP
The Things Stack can automatically decode CayenneLPP formatted payloads, no custom code neccessary. To find out how to use CayenneLPP payload formatters, see the CayenneLPP section.
Repository
Device manufacturers may submit payload formatters designed to work with their devices. These are publicly available in The Things Stack Device Repository.
Device repository payload formatters work right out of the box – no customization needed!
Application and Device Specific Payload Formatters
Payload formatters can be applied to an entire application, or to a specific end device. Application payload formatters are useful if all devices use the same binary payload format, or as a fallback when no device specific payload formatter is set.
Device payload formatters allow you to specify a unique payload formatter for each device.
Note:
Device payload formatters override application payload formatters.Working with Bytes
To work with payload formatters, it is important to understand how payload data is encoded as binary bytes, and how to convert it to meaningful fields.
To see how your device encodes environmental data, see your product datasheet.
See The Things Network Learn for an introduction to working with bytes.