Created
January 7, 2019 09:29
-
-
Save maxrodrigo/5f1ea7663b066bc24c4e769e2010cf73 to your computer and use it in GitHub Desktop.
Convert csv to json with jq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jq --slurp --raw-input --raw-output \ | |
'split("\n") | .[1:] | map(split(",")) | | |
map({"id": .[0], | |
"example": .[1], | |
"attribute": .[2]})' \ | |
example.csv > example.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get an additionale "null" part here.
{ "id": null, "example": null, "attribute": null }