# Ixon MQTT Evaluation: Convert data structure into a more usable format

**URL:** <https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [August 22, 2024, 5:41pm UTC](https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024 "2024-08-22T17:41:26Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 22, 2024, 5:41pm UTC](https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024/1 "2024-08-22T17:41:26Z")

</div>

I'm evaluating an MQTT solution for data collection on a certain machine. The data comes in an odd way. I'm not really getting individual tags like I would expect, but a series of values in an array.

I'm wondering if I can make the data more usable and transform this data where the `name` is an actual tag instead of an item in the metrics array. Any ideas?

It seems like unnecessary overhead to be required to parse the payload and write the values to tags every time `seq` increments.

```python
{
  "metrics": [
    {
      "alias": 2,
      "datatype": 12,
      "name": "Disturbancetime",
      "timestamp": 1724348040000,
      "value": "396:30:42"
    },
    {
      "alias": 6,
      "datatype": 12,
      "name": "Maintenancetime",
      "timestamp": 1724348040000,
      "value": "00:00:00"
    },
    {
      "alias": 11,
      "datatype": 12,
      "name": "Operationtime",
      "timestamp": 1724348040000,
      "value": "736:55:12"
    },
    {
      "alias": 16,
      "datatype": 12,
      "name": "Setuptime",
      "timestamp": 1724348040000,
      "value": "242:43:27"
    },
    {
      "alias": 18,
      "datatype": 12,
      "name": "Standstilltime",
      "timestamp": 1724348040000,
      "value": "1691:27:31"
    },
    {
      "alias": 20,
      "datatype": 10,
      "name": "Totaloperationtime",
      "timestamp": 1724348040000,
      "value": 3
    },
    {
      "alias": 22,
      "datatype": 3,
      "name": "Velocity",
      "timestamp": 1724348040000,
      "value": 10312
    }
  ],
  "seq": 230,
  "timestamp": 1724348040008
}

```

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 22, 2024, 5:45pm UTC](https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024/2 "2024-08-22T17:45:15Z")

</div>

This looks like a Sparkplug payload. You aren't meant to parse it yourself (though you can, since this is the JSON encoded payload), you're meant to use something that understands Sparkplug on both ends.

Are you using the Ignition MQTT modules?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 22, 2024, 5:51pm UTC](https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024/3 "2024-08-22T17:51:53Z")

</div>

Yes, I am. The data is coming from an Ixon router, which supports Sparkplug B; however, it was not being parsed correctly on Cirrus Link's side (no tags displayed). Something about google protobufs, so I tried straight JSON format.

If the Sparkplug format would handle the structure better, as you suggested, I will switch back and debug it further with Cirrus Link's support.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 27, 2024, 8:31pm UTC](https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024/4 "2024-08-27T20:31:56Z")

</div>

Turns out that Ixon deviates from the Sparkplug spec as they do not send a birth message which Engine requires. The JSON format is as good as it gets ☹

Ixon Docs  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/c/5ce4493f5b6459d4d543f2253a0082d0ee6a01c9.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 27, 2024, 8:43pm UTC](https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024/5 "2024-08-27T20:43:45Z")

</div>

🙄 🙄 🙄

Special place in hell for people who take something with a specification and tweak it such that it's incompatible with that specification.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 27, 2024, 8:49pm UTC](https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024/6 "2024-08-27T20:49:15Z")

</div>

This calls for the extreme eye-roll:

![xtra_roll_eyes](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/6/f6cfd28d2ba205f663b027dd69b86f5f5f5f7b0e.png)

(Credit to @Felipe_CRM )

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [August 27, 2024, 8:51pm UTC](https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024/7 "2024-08-27T20:51:23Z")

</div>

> [@dkhayes117](#):
>
> I'm evaluating an MQTT solution for data collection on a certain machine.

I would say that it is failing your evaluation and I would look for something else. You might check out RedLion's DA10/DA30/DA50 line as I believe they support SparkplugB and can talk to lots of different devices.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [August 27, 2024, 8:55pm UTC](https://forum.inductiveautomation.com/t/ixon-mqtt-evaluation-convert-data-structure-into-a-more-usable-format/95024/8 "2024-08-27T20:55:34Z")

</div>

The Ixon router is part of an OEM machine, I don't have admin access to its configuration, so I can't just replace it. At least, that I'm aware of.

The good news is the OEM is working on an OPC-UA server as an alternative. I can only hope that it conforms to the OPC-UA spec 😅

I'm going to be a beta tester, hopefully, this fall.
