Created
August 23, 2020 14:46
-
-
Save jmpinit/d961e792902b87f6ffccf0d69d900413 to your computer and use it in GitHub Desktop.
JSON to CSV with 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
| # The input file contains an array of objects where each object contains fields that we would like to extract | |
| # as the rows of our CSV file | |
| # https://stedolan.github.io/jq/ | |
| # -r is to output raw text instead of JSON | |
| # foo and bar are the fields we are interested in | |
| jq -r 'map([.foo, .bar] | join(", ")) | join("\n")' input.json > output.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment