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

Get sub-objects in JSON where key values unknown

$
0
0

I have the following JSON generated from a command. The JSON is composed of objects where the key is a random string, and I want to access data in each of those objects. Any thoughts on how to do that, without knowing the value of the key for each object?

{"provisionInfo": {"2b66706e-237c-4d05-b3c0-31b03186b9e5": {"Status": "Up","key": "value"    },"3fb6886e-9877c-4d05-b39f-31b03186b9e5": {"Status": "Up","key": "value"    }  }}

I know I can do this to get the objects:

$ cat tmp.json | jq -c '.provisionInfo'{"2b66706e-237c-4d05-b3c0-31b03186b9e5":{"Status":"Up","key":"value"},"3fb6886e-9877c-4d05-b39f-31b03186b9e5":{"Status":"Up","key":"value"}}

But how do I access the value of Status for both objects without knowing the index?


Viewing all articles
Browse latest Browse all 524

Trending Articles



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