How to use `jq` to obtain the keys
You can simply use: keys
:
% jq 'keys' my.json[ "20160522201409-jobsv1-1"]
And to get the first:
% jq -r 'keys[0]' my.json20160522201409-jobsv1-1
-r
is for raw output:
--raw-output / -r:
With this option, if the filter’s result is a string then it will be written directly to standard output rather than being formatted as a JSON string with quotes. This can be useful for making jq filters talk to non-JSON-based systems.
If you want a known value below an unknown property, eg xxx.hostName
:
% jq -r '.[].hostName' my.json20160522201409-jobsv1-1