Last active
December 3, 2021 18:06
-
-
Save johnmurch/2ad639e72e220be4fa1b38677f7ad21d to your computer and use it in GitHub Desktop.
Convert JSON to CSV via CLI
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 sample.json| jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' > sample.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment