I\'m taking a modified command from the jq
tutorial:
curl \'https://api.github.com/repos/stedolan/jq/commits?per_page=5\' \\
| jq -r -c \'.[] | {mes
While I fully realize OP was looking for a purely jq answer, I found this question looking for any answer. So, let me offer one I found (and found useful) to others like me.
sudo apt install moreutils
- if you don't have them yet. Moreutils website.echo "Any, column, name, that, is, not, in, your, json, object" | cat - your.csv | sponge your.csv
Disadvantages: requires moreutils
package, is not just jq
-reliant, so some would understandably say less elegant.
Advantages: you choose your headers, not your JSON keys. Also, pure jq
ways are bothered by the sorting of the keys, depending on your version.
tee
without having to install any packages!No, you could not, as Kos excellently demonstrates here. Not unless you're fine with loosing your csv at some point.