Telegraf parse Mqtt payload

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

@Rosario_Iameo I suggest to use the XPath parser here as it is easier to use and can handle lists better than the JSON v2 one. With the config

[[inputs.mqtt_consumer]]
  ...

  data_format = "xpath_json"
  xpath_native_types = true

  [[inputs.mqtt_consumer.xpath]]
    metric_name = "'sensors'"
    metric_selection = "/metrics/*"
    timestamp = "timestamp"
    timestamp_format = "unix_ms"

    [inputs.mqtt_consumer.xpath.fields]
      value = "value"

    [inputs.mqtt_consumer.xpath.tags]
      name = "name"

you will get the following metrics

> sensors,host=Hugin,name=01TT101 value=21.51331329345703 1731970320000000000
> sensors,host=Hugin,name=01JT001_Energy value=430 1731970320000000000
> sensors,host=Hugin,name=01JT001_Flow value=0 1731970320000000000