Telegraf exec Parsing not working

I have made a CLI tool that consumes an API and prints the json response or golang objects to the stdout.
I want to use [[inputs.exec]] to run a command that prints response.Body , which is a json, using the tool and save the output to influxdb.later I will visualize data using Grafana.
please help to setup the telegraf.conf file.

I don’t think that this is something that input.exec is going to be able to do. What you probably want to do is either a) write a program or shell script that can grab response.Body and feed that JSON object to the Telegraf JSON parser or use the http_listener plugin to deal with the input.

Best regards,
dg

@itsksaurabh Using telegraf 1.8, you can use parts from the following (working) config:

[[inputs.exec]]
  timeout = "1s"
  data_format = "json"
  command = "echo -en '{\"verb\":\"GET\",\"request\":\"/time/to/awesome\"}'"
  tag_keys = ["verb"]
  json_string_fields = ["request"]

[[outputs.file]]
  files = ["stdout"]

Note the data_format, telling telegraf to parse the output of the exec command[s] as json. You may also need to specify tag_keys and json_string_fields, depending on the json body. Read more in the docs.