Proper JSON Formatting ModBus data and using Data to Server MQTT

I want to read a set of Modbus data and then push it out in a JSON in one MQTT message.
I’ve found this post which asked the same question and a software update was going to fix this.

"Apologies, indeed, it currently is not possible to achieve this with the current Data to Server instance.
Data sender will receive a lot of improvements with the next RutOS release, which will make such configuration possible. The release date for this firmware is currently unknown."

  • This was August 2023. Has the Data Server update been done in the meantime?
  • Is there another way to do this?

Whatever I try I end up with a non properly formatted JSON making the parsing of that object more difficult in NodeRED.



I’m starting to suspect that there is a bug here.

When I put the format type JSON, a get nicely formatted objects.

{“RouterData”:[{“timestamp”:1711579700,“date”:“27/03/2024 23:48:20”,“bdate”:null,“server_id”:1,“bserver_id”:1,“addr”:40,“baddr”:null,“full_addr”:“400040”,“size”:12,“data”:“"1122577335"”,“raw_data”:null,“server_name”:“RouterInfo”,“ip”:“”,“name”:“RouterSerial”},{“timestamp”:1711579700,“date”:“27/03/2024 23:48:20”,“bdate”:null,“server_id”:1,“bserver_id”:1,“addr”:72,“baddr”:null,“full_addr”:“400072”,“size”:8,“data”:“"TRB255"”,“raw_data”:null,“server_name”:“RouterInfo”,“ip”:“”,“name”:“RouterName”},{“timestamp”:1711579700,“date”:“27/03/2024 23:48:20”,“bdate”:null,“server_id”:1,“bserver_id”:1,“addr”:144,“baddr”:null,“full_addr”:“400144”,“size”:9,“data”:“50.976974”,“raw_data”:null,“server_name”:“RouterInfo”,“ip”:“”,“name”:“GPSLat”},{“timestamp”:1711579700,“date”:“27/03/2024 23:48:20”,“bdate”:null,“server_id”:1,“bserver_id”:1,“addr”:146,“baddr”:null,“full_addr”:“400146”,“size”:8,“data”:“3.199957”,“raw_data”:null,“server_name”:“RouterInfo”,“ip”:“”,“name”:“GPSLong”}]}

If I go to “Custom”, and use standard JSON formatting, I do not get the objects anymore.
JSON formatting : {“TS”:“%timestamp%”, “%name%”:“%data%”}

{“RouterData”:“{"TS":"1711579810", "RouterSerial":""1122577335""},{"TS":"1711579810", "RouterName":""TRB255""},{"TS":"1711579810", "GPSLat":"50.976974"},{"TS":"1711579810", "GPSLong":"3.199956"},{"TS":"1711579820", "RouterSerial":""1122577335""},{"TS":"1711579820", "RouterName":""TRB255""},{"TS":"1711579820", "GPSLat":"50.976974"},{"TS":"1711579820", "GPSLong":"3.199957"}”}

Am I doing something wrong or is this indeed a bug?

@Marija Could I please get a reaction on this ?

Thank you!


Your linked issue was regarding a different issue, and relates to the grouping of data from different sources. With 07.05 new Data to Server was released with much more flexibility with the configuration.
As for this issue, could you clarify what data format you are expecting to receive, and what you actually receive?
Thank you.

Best regards,


on the linked issue : all the data was coming via the internal modbus server (reading data from the Teltonika device using the local modbus server), but let’s not focus on that.

I’m trying to get the data in a JSON object so that e.g. NodeRED can parse the JSON object as an object, not as a string (currently it get’s recognised as a string).

The idea is, I want to be able to map a set of modbus registers to a JSON object which I can than parse on the application side.

Thanks for you feedback!

This topic was automatically closed after 15 days. New replies are no longer allowed.