(Solved) Inserting multiple rows using JSON

Hi,
I’m trying to insert data into InfluxDB using JSON data format over MQTT. The JSON string contains values for 2 different parameters that I want to insert to two different rows of InfluxDB. How can we do this?

For example,
sample JSON string:

[
{
“DataType”:17,
“Data_Value”:6,
“Connection”:“192.168.5.110”,
“Parameter”:“current”,
“Topic”:“EVENT”
},
{
“DataType”:17,
“Data_Value”:56,
“Connection”:“192.168.5.110”,
“Parameter”:“voltage”,
“Topic”:“EVENT”
}
]

There is a table with fields “DataType”, “Data_Value”, “Connection”, “Parameter”, “Topic”.
I want to enter two rows for the given JSON string. How do we do that?

Thanks in advance.

Hi @sahebdatta, are you using Telegraf to get these from your MQTT broker, or are you writing them to InfluxDB’s APIs yourself?

1 Like

Hey,
I am using telegraf but the problem is solved now.
Thanks for your response. It had to do with JSON format. I got the solution from here JSON input data format | Telegraf 1.17 Documentation

Thanks.