Useful notes about using jq.
- Print all paths to values
jq -c paths
Prints each path as an array and doesn't show values.jq --stream 'select(.[1]|scalars!=null) | "\(.[0]|join(".")): \(.[1]|tojson)"' example.json
Nearly perfect. If each path shown began with.
and array indices were enclosed in square brackets, then each one would be a valid jq query string.jq -r 'paths(scalars) as $p | $p + [getpath($p)] | join(".")'
Prints dot-delimited paths concatenated with values.