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

Get all nested keys and values using jq

$
0
0

I have a json like this

{"outer1": {"outer2": {"outer3": {"key1": "value1","key2": "value2"      }    },"outer4": {"key1": "value1","key2": "value2"    }  }}

I want output to be

[outer1.outer2.outer3]key1 = value1key2 = value2[outer1.outer2.outer4]key1 = value1key2 = value2

I tried jq -r 'to_entries|map("\(.key)=\(.value|tostring)")|.[]' test.json But its not what is what I want exactly


Viewing all articles
Browse latest Browse all 657

Trending Articles



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