I'm a newbie to Go and trying use a library from github to parse JSON to CSV. https://github.com/jehiah/json2csv
But i encountered this issue: https://github.com/jehiah/json2csv/issues/22 to which the author is not replying.
I realized that if we give following JSON as json.input to the file:
{"user": {"name":["jehiah, mike, semo"], "password": "root"}, "remote_ip": "127.0.0.1", "dt" : "[20/Aug/2010:01:12:44 -0400]"}
{"user": {"name":["jeroenjanssens", "jeroen2", "jero55"], "password": "123"}, "remote_ip": "192.168.0.1", "dt" : "[20/Aug/2010:01:12:44 -0400]"}
{"user": {"name":"markdata", "password": ""}, "remote_ip": "76.216.210.0", "dt" : "[20/Aug/2010:01:12:45 -0400]"}
Now if i try using it as command: go run main.go -k user.name -i input.json -o output.json
it returns following output:
"[jehiah, mike, semo]"
[jeroenjanssens jeroen2 jero55]
markdata
but as described in opend issued, i'm expecting the response as:
jehiah, mike, semo
jeroenjanssens, jeroen2, jero55
markdata
i'm guessing it is happening due to line: https://github.com/jehiah/json2csv/blob/master/main.go#L110 which is anyhow removing commas while reading the line.
Can you please advice to how to achieve above desired output?
Regards