Created
March 17, 2020 01:29
-
-
Save gigkokman/bf3b305f1073c176403958628419bb2b to your computer and use it in GitHub Desktop.
Export json to csv with header via jq script
This file contains hidden or 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
echo '{"a":"aa", "b":"bb"}' | jq -r -s '. | (map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment