Like many people, I use Google Sheets to quickly create and share tabular data. As well as
creating spreadsheets by pasting results generated in
I often create reports from JSON files using
JQ. This post is a note-to-self on how to do
Here’s a command to create a tab-separated report from a JSON events file exported from Loggly:
$ cat loggly_events.json | \ jq -r '.events.event.json | select(.params | has("payment_day")) | [.timestamp, .account, .params.payment_day] | @tsv' | clipboard
-roption instructs JQ to output raw strings, not quoted JSON strings.
@tsvis a JQ format string for outputting tab-separated values.
clipboardcommand is an alias for
pbcopy, the system clipboard on OS-X.