Created
June 15, 2022 20:26
-
-
Save akramarev/7633746d8310d1eb12e30959a1e65dd9 to your computer and use it in GitHub Desktop.
[Convert JSON to CSV via the Command Line Using JQ]
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
# https://earthly.dev/blog/convert-to-from-json/ | |
cat simple.json| jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment