jq: print key and value for each entry in an object
To get the top-level keys as a stream, you can use the built-in function keys[]. So one solution to your particular problem would be: jq -r ‘keys[] as $k | “\($k), \(.[$k] | .ip)”‘ keys produces the key names in sorted order; if you want them in the original order, use keys_unsorted. Another alternative, which … Read more