-
-
Notifications
You must be signed in to change notification settings - Fork 105
Description
I currently use jq to convert a json object to csv format, generically without referring to field names (usually a json object with an array). The filter looks like this:
jq -r '(.[] | map(paths(scalars|true)) | unique) as $cols | map(.[] as $row | ($cols | map(. as $col | $row | getpath($col)))) as $rows | ([($cols | map(. | map(tostring) | join(".")))] + $rows) | map(@csv) | .[]'
I would like to see if there's any performance gain using jaq for the above task, but when I get started, trying paths(scalars), I get an "undefined filter" error.
Since the function paths() doesn't seem to be supported, is there an alternate way to get paths to scalar values in jaq?
Also, is there jaq-specific documentation that lists available operators and functions?
Thanks!