Powerful json message parsing on the command line

# Gets me all keys connected to the doc node
jq '. | keys' a.json

# Tells me how many sub docs are rooted at events
jq '.events | count' a.json

# Generate a csv from a json array
# https://stackoverflow.com/questions/32960857/how-to-convert-arbitrary-simple-json-to-csv-using-jq/32965227#32965227
jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' a.js.out