Telegraf parse Mqtt payload

Rosario_Iameo
Mon, 18 Nov 2024 22:56:00 +0000
Telegraf

Hi all,
im tring to pars the payload of topics from mqtt brokerwith telegraf but i dont undestand how it work with json_v2 parser.
the json object is :
{
“metrics”: [
{
“alias”: 2,
“datatype”: 9,
“name”: “01TT101”,
“timestamp”: 1731970320000,
“value”: 21.51331329345703
},
{
“alias”: 3,
“datatype”: 9,
“name”: “01JT001_Energy”,
“timestamp”: 1731970320000,
“value”: 430
},
{
“alias”: 4,
“datatype”: 9,
“name”: “01JT001_Flow”,
“timestamp”: 1731970320000,
“value”: 0
}]

I would likt to parse it to have a metrics with name , value and timestamp to save in influx db.

is there somebody can explin me how it work the json_v2 parser?

thanks in advance

2 posts - 2 participants