Skip to content

Instantly share code, notes, and snippets.

@akramarev
Created June 15, 2022 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akramarev/7633746d8310d1eb12e30959a1e65dd9 to your computer and use it in GitHub Desktop.
Save akramarev/7633746d8310d1eb12e30959a1e65dd9 to your computer and use it in GitHub Desktop.
[Convert JSON to CSV via the Command Line Using JQ]
# 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