Configure Telegraf for nested array of timestamps and data

I have a json array coming in over mqtt that looks like the following

{
  "Sensor1": {
    "Time": [
      1721423157027428600,
      1721423157031428600,
      1721423157035428600,
      1721423157039428600,
      1721423157043428600,
      1721423157047428600,
      1721423157051428600,
      1721423157055428600,
      1721423157059428600,
      1721423157063428600
    ],
    "Data1": [
      0.5375196810086651,
      0.9610414132027387,
      0.0018270982367867283,
      0.3682829898479403,
      0.1601324861510789,
      0.19179781722154354,
      0.930889384682748,
      0.49418687417064033,
      0.7972837143268192,
      0.10455857994855733
    ]
  }
}

What I want is the following is the following influxdb line protocol output

foobar,Sensor1 Data1=0.5375196810086651 1721423157027428600
foobar,Sensor1 Data1=0.9610414132027387 1721423157031428600
foobar,Sensor1 Data1=0.0018270982367867283 1721423157035428600
.
.
.

You get the point

Here is my config

[[inputs.mqtt_consumer]]
   servers = ["tcp://127.0.0.1:1883"]
   topics = ["sensordata"]
   data_format = "json_v2"
[[inputs.mqtt_consumer.json_v2]]
        measurement_name = "Sensor1"
        timestamp_path = "Sensor1.Time.0"
        timestamp_format = "unix_ns"

        [[inputs.mqtt_consumer.json_v2.field]]
            path = "Sensor1.Data1.0"
            type = "float"
            rename = "Data1"

[[inputs.mqtt_consumer.json_v2]]
        measurement_name = "Sensor1"
        timestamp_path = "Sensor1.Time.1"
        timestamp_format = "unix_ns"

        [[inputs.mqtt_consumer.json_v2.field]]
            path = "Sensor1.Data1.1"
            type = "float"
            rename = "Data1"

[[inputs.mqtt_consumer.json_v2]]
        measurement_name = "Sensor1"
        timestamp_path = "Sensor1.Time.2"
        timestamp_format = "unix_ns"

        [[inputs.mqtt_consumer.json_v2.field]]
            path = "Sensor1.Data1.2"
            type = "float"
            rename = "Data1"
.
.
.

And this for a total of 10 times.
This produces the result I want, however, i am setting up a config for every single data point.
Is there an easier way to configure Telegraf? I have read through many of the examples in github but i can’t figure out how to do this easier in the config.
Am i doing something wrong?

@natwez22 Do you have any control over how the JSON is structured? This seems like an odd data structure. As-is, I think this is probably the best you can do. In an ideal world, the JSON would be structured something like this:

{
  "Sensor1": {
     "Data1": [
        {"Time": 1721423157027428600, "Value": 0.5375196810086651},
        {"Time": 1721423157031428600, "Value": 0.9610414132027387},
        {"Time": 1721423157035428600, "Value": 0.0018270982367867283},
        {"Time": 1721423157039428600, "Value": 0.3682829898479403},
        {"Time": 1721423157043428600, "Value": 0.1601324861510789},
        {"Time": 1721423157047428600, "Value": 0.19179781722154354},
        {"Time": 1721423157051428600, "Value": 0.930889384682748},
        {"Time": 1721423157055428600, "Value": 0.49418687417064033},
        {"Time": 1721423157059428600, "Value": 0.7972837143268192},
        {"Time": 1721423157063428600, "Value": 0.10455857994855733}
    ]
  }
}

This would be a lot easier to parse.

Question–with the JSON payload you’re receiving, are the timestamps actually all the same or are these just dummy timestamps you included as an example? The reason I ask is because InfluxDB uniquely identifies data by timestamp and tag set. Where these all have the same timestamp and tag set, these values are just going to overwrite eachother.