Skip to content

Instantly share code, notes, and snippets.

@sonnyksimon
Created September 7, 2022 19:03
Show Gist options
  • Save sonnyksimon/b1aa4db109f0bf4894f826bcee51049c to your computer and use it in GitHub Desktop.
Save sonnyksimon/b1aa4db109f0bf4894f826bcee51049c to your computer and use it in GitHub Desktop.
jq --slurp --raw-input
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