How to change protobuf to json in the configuration file with docker

Hi.
I have install Chirpstack with docker compose(https://github.com/chirpstack/chirpstack-docker). I use mqtt integration for retrieve the data. On topic /application/app_id/device/dev_id/event the data are format in protobuf; how to change configuration for json?
Best regards

That repo already uses json=true for integration (/application) events:

Are you using the default configuration, or perhaps thinking of the gateway topic?

Hi, ok… i have wrong the question: i use the default configuration with json=true and payload in the mqtt topic /application/app_id/device/dev_id/event/up is ok:

The true question is: the data in the frame payload is in Hex format “5b7b202253656e736f725f3031223a31352e312c2253656e736f725f3032223a3130302e327d5d” ,
the data in the mqtt payload is:
“W3sgIlNlbnNvcl8wMSI6MTUuMSwiU2Vuc29yXzAyIjoxMDAuMn1d”
Don’t understand this change…

When rendered as JSON, the protobuf bytes fields are encoded as base64:

$ echo W3sgIlNlbnNvcl8wMSI6MTUuMSwiU2Vuc29yXzAyIjoxMDAuMn1d|base64 -D|hexdump -C
00000000  5b 7b 20 22 53 65 6e 73  6f 72 5f 30 31 22 3a 31  |[{ "Sensor_01":1|
00000010  35 2e 31 2c 22 53 65 6e  73 6f 72 5f 30 32 22 3a  |5.1,"Sensor_02":|
00000020  31 30 30 2e 32 7d 5d                              |100.2}]|
00000027

As a side note, that’s a fairly large payload for LoRaWAN. You really don’t want to waste payload space with JSON content.

Yes, i agree, the json format is only for test. I want use the protobuf at end the testing phase.

I was actually referring to [{ "Sensor_01":15.1,"Sensor_02":100.2}]. Once a payload hits a gateway, bandwidth/airtime constraints are a little less of a concern. But sure.

True, I don’t use any payload codecs; i want to try cayenne or a custom javascript function, as soon as understand how to do it … :smiley:

1 Like