Search code examples
jsoninfluxdb

How to convert a text file to JSON


I intend to write a data set from a text file into a JSON database Influxdb. I'm really newbie in this context. How can I convert sample below text file into JSON or is there a better solution rather than conversion?

[1443106507] [INSERT], Operations, 10000.0
[1443106507] [INSERT], AverageLatency(us), 1114.4243
[1443106507] [INSERT], MinLatency(us), 379.0
[1443106507] [INSERT], MaxLatency(us), 550399.0
[1443106507] [INSERT], 95thPercentileLatency(us), 1288.0
[1443106507] [INSERT], 99thPercentileLatency(us), 8679.0
[1443106507] [INSERT], Return=0, 10000

Thanks.


Solution

  • If you're using InfluxDB 0.9 a better solution would be to use the line protocol for writes. It's faster and less error prone.