Created
November 20, 2023 16:21
-
-
Save arosenkranz/f129b75efc777bb1d22c1f4956866f36 to your computer and use it in GitHub Desktop.
Convert JSON to CSV
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
cat <file.json> | jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' > <output.csv> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment