Json_v2 array of objects parsing with mqtt consumer

Hi, I’m having trouble with parsing mqtt consumer data in the form of a json array containing multiple object entries.

My json array looks like this:

[{“id”:10830,“time”:23297316,“pressure”:1833.389526,“t11”:18.6,“t12”:17.56,“t1out”:7.01,“interval1”:0},{“id”:10831,“time”:23299335,“pressure”:1619.95752,“t11”:18.87,“t12”:17.76,“t1out”:7.01,“interval1”:0},{“id”:10832,“time”:23301354,“pressure”:1838.443726,“t11”:18.74,“t12”:17.39,“t1out”:6.67,“interval1”:0},{“id”:10833,“time”:23303364,“pressure”:1789.278687,“t11”:18.64,“t12”:17.22,“t1out”:7.14,“interval1”:0},{“id”:10834,“time”:23305383,“pressure”:1819.719482,“t11”:18.74,“t12”:17.29,“t1out”:6.98,“interval1”:0}]

My telegraf.conf file mqtt.consumer looks like this:

[[inputs.mqtt_consumer]]
  servers = ["hivemq-server:8883"]
  topics = ["name/product/metrics/+"]
  qos = 2
  connection_timeout = "30s"
  persistent_session = true
  client_id = "telegraf"
  username = "username"
  password = "password"

  [[inputs.mqtt_consumer.topic_parsing]]
    topic = "name/product/metrics/+"
    tags = "_/_/_/id"

  data_format = "json_v2"
  name_override = "logging_data"
  [[inputs.mqtt_consumer.json_v2]]
    [[inputs.mqtt_consumer.json_v2.fields]]
      id = "uint"
      time = "uint"
      pressure = "float"
      t11 = "float"
      t12 = "float"
      t1out = "float"
      interval1 = "uint"

But I’ve already tried a number of different configuration options, including wrapping the fields in a [[inputs.mqtt_consumer.json_v2.object]] with path = “@this”.

The error I’m getting is the following:
error loading config file /etc/telegraf/telegraf.conf: plugin inputs.mqtt_consumer: line 128: configuration specified the fields ["json_v2"], but they weren't used

I’m running telegraf in a docker container.

Thanks for your help in advance.

You might want to use the xpath parser:

  data_format = "xpath_json"
  xpath_native_types = true

  [[inputs.mqtt_consumer.xpath]]
    metric_name = "'logging_data'"
    metric_selection = "child::*"
    field_selection = "*"