Skip to content

How to convert a CSV file into a JSON, line by line, using LUA? #14287

Answered by rcmv
rcmv asked this question in Q&A
Discussion options

You must be logged in to vote

I got the bug using the Remap/parse_csv approach. With Lua still does not work. The problem was the csv file delimiter. The delimiter was ';' and I think the parse_csv use by default the delimiter ','.
I changed my csv file delimiter from ; to , and now I'm getting the following output:

{"Timestamp":"Timestamp","country":"country","duration":"duration","file":"/home/rcmv2/ftp/sample.csv","host":"ip-172-31-28-49.ec2.internal","message":"Timestamp,country,duration,quality\r","quality":"quality","source_type":"file","timestamp":"2022-09-07T13:52:18.056567562Z"} {"Timestamp":"06/09/2022 10:33","country":"UAE","duration":"7.8470","file":"/home/rcmv2/ftp/sample.csv","host":"ip-172-31-28-49.ec2.…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@rcmv
Comment options

@rcmv
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by jszwedko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants