Created
September 7, 2022 19:03
-
-
Save sonnyksimon/b1aa4db109f0bf4894f826bcee51049c to your computer and use it in GitHub Desktop.
jq --slurp --raw-input
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
split("\n") | |
| ( | |
.[0] | |
| split(",") | |
) as $head | |
| .[1:] | |
| map | |
( | |
split(",") | |
| to_entries | |
| map | |
( | |
select | |
( | |
[$head[.key]] | |
| inside(["", "\r"]) == false | |
) | |
| .key = | |
($head[.key]) | |
| .value = | |
( | |
.value as $v | |
| try | |
( | |
$v | |
| fromjson | |
) | |
catch | |
$v | |
) | |
) | |
| from_entries | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment