# Telegraf error: \[inputs.mqtt\_consumer\] Error in plugin: metric parse error:

**URL:** <https://community.influxdata.com/t/telegraf-error-inputs-mqtt-consumer-error-in-plugin-metric-parse-error/23069>\
**Category:** Telegraf\
**Tags:** telegraf, mqtt, json\
**Created:** [December 21, 2021, 7:17pm UTC](https://community.influxdata.com/t/telegraf-error-inputs-mqtt-consumer-error-in-plugin-metric-parse-error/23069 "2021-12-21T19:17:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bigman74066](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bigman74066/32/9049_2.png) [@Bigman74066](https://community.influxdata.com/u/Bigman74066)\
**Post date:** [December 21, 2021, 7:17pm UTC](https://community.influxdata.com/t/telegraf-error-inputs-mqtt-consumer-error-in-plugin-metric-parse-error/23069/1 "2021-12-21T19:17:52Z")

</div>

Hi Everybody,

I’m using Telegraf with MQTT as an input plugin. MQTT is sending these kind of JSON messages:  
{“Count”:905658,“Momentary”:180014.625000,“Units”:40,“UnitsText”:“ltr”,“Period”:30,“PeriodText”:“hour”}

Relevant parts of telegraf.conf:  
servers = [“tcp://broker.mqttdashboard.com:1883”]  
topics = [“Counters/#”,]  
qos = 2  
data\_format = “json”

Telegraf cannot parse the input:  
2021-12-21T19:09:42Z E! [inputs.mqtt\_consumer] Error in plugin: metric parse error: expected tag at 1:42: “{“Count”:893409,“Momentary”:180011.250000,“Units”:40,“UnitsText”:“ltr”,“Period”:30,“PeriodText”:“hour”}”

JSON LINT finds no errors in my JSON messages…

I’ve been busting my head on this one for half a day now, anybody know what’s wrong?

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/franky1/32/6666_2.png) [@Franky1](https://community.influxdata.com/u/Franky1)\
**Post date:** [December 21, 2021, 7:33pm UTC](https://community.influxdata.com/t/telegraf-error-inputs-mqtt-consumer-error-in-plugin-metric-parse-error/23069/2 "2021-12-21T19:33:33Z")

</div>

You have to configure the json input:

> [JSON input data format | Telegraf Documentation](https://docs.influxdata.com/telegraf/v1.21/data_formats/input/json/)

---

<div class="post-metadata">

**Author:** ![Bigman74066](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/bigman74066/32/9049_2.png) [@Bigman74066](https://community.influxdata.com/u/Bigman74066)\
**Post date:** [December 21, 2021, 7:41pm UTC](https://community.influxdata.com/t/telegraf-error-inputs-mqtt-consumer-error-in-plugin-metric-parse-error/23069/3 "2021-12-21T19:41:27Z")

</div>

Hi @Franky1 ,

Thanks for your quick reply!  
I’ve been looking into that, but I don’t think that would eliminate the error(?)  
What kind of configuration would you suggest I do to get rid of the error message?

Best regards,  
Bert

P.s.  
I added this to the configuration:  
data\_format = “json”  
**tag\_keys = [“Count”]**  
That got rid of the error. Not sure what it means though 🙂 but I intend to find out tomorrow…
