4 ms·
TIMTOWTDI: $ jq -n -r '[{"a": "b", "foo": "bar"}, {"c": "d", "baz": "quux"}] | .[] | [ keys_unsorted[] as $k | .[$k] ] | @csv' "b","bar" "d","quux" $
by dossy 4y ago
TIMTOWTDI:
$ jq -n -r '[{"a": "b", "foo": "bar"}, {"c": "d", "baz": "quux"}] | .[] | [ keys_unsorted[] as $k | .[$k] ] | @csv'
"b","bar"
"d","quux"
$ jq -n -r '[{"a": "b", "foo": "bar"}, {"c": "d", "baz": "quux"}] | .[] | to_entries | map(.value) | @csv'
"b","bar"
"d","quux"
FWIW, OP uses `keys` instead of `keys_unsorted` which makes a specific assumption about the shape of the input objects. YMMV.