show structure of all levels of json with jq and bash -


how can list unique keys of json file levels , array attributes, path?

i found jq -s 'map(keys) | add | unique | sort' input.json, lists first level, , no paths.

if stream input in, give pairs of paths , values contained in input.

$ jq --stream 'select(length>1)[0]' input.json 

so input this:

{   "foo": { "bar": 1 },   "biz": { "baz": 2 } } 

you'd get:

[   "foo",   "bar" ] [   "biz",   "baz" ] 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -