-
Notifications
You must be signed in to change notification settings - Fork 0
Awesome JQ
nntrn edited this page Jul 13, 2023
·
1 revision
Convert git log output to JSON using jq
git log --pretty=format:'%H%x00%an <%ae>%x00%ad%x00%s%x00' | \
jq -R -s '[split("\n")[:-1] | map(split("\u0000")) | .[] | {
"commit": .[0],
"author": .[1],
"date": .[2],
"message": .[3]
}]'
Flattening nested JSON objects with jq
jq '[.[] | [leaf_paths as $path | {"key": $path | join("_"), "value": getpath($path)}] | from_entries]'