-
Hi all, I need to create a custom json from csv by selecting particular fields from the csv source file. The source file has the following header format |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I got the most close with jq by using this |
Beta Was this translation helpful? Give feedback.
-
Dasel currently only supports a comma delimited file but I'd be happy to add a flag to change that. If this were comma delimited the following should work: dasel -f my_file.csv -w json -m '.(state=finished)' This will read my_file.csv into memory with Each line of output will be a json object. Here's a runnable example: https://dasel.tomwright.me/s/892efbcb-8c30-4cd9-b65a-44ee892b9fa2 Sorry for the delayed response. I've been pretty busy recently and not had much time to catch up. |
Beta Was this translation helpful? Give feedback.
Dasel currently only supports a comma delimited file but I'd be happy to add a flag to change that.
If this were comma delimited the following should work:
dasel -f my_file.csv -w json -m '.(state=finished)'
This will read my_file.csv into memory with
-f
, allow you to select multiple records with-m
, output in JSON with-w json
and filter only the finished rows with the selector.Each line of output will be a json object.
Here's a runnable example: https://dasel.tomwright.me/s/892efbcb-8c30-4cd9-b65a-44ee892b9fa2
Sorry for the delayed response. I've been pretty busy recently and not had much time to catch up.