Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 527

How to recursively print the path of all keys in jq

$
0
0

I'd like to get a list of all paths available in a JSON document, just to get an idea of the layout of a big json document.

One liners preferred, of course a big jq/python program can do the trick.

Example:

$ jq -r 'short magic here'<<< '{"k1": {"k12": "v12"}, "k2": {"k21": {"k211": "v211"}}}'k1k1.k12k2k2.k21k2.k21.k211

There are variations (not exactly duplicates) of this question like 'all paths matching a given pattern' or 'print paths plus value'. I'm asking just about the keys, all of them, and a short expression.

There is also third parties like gron that prints keys and values colorized.


Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>