I have a JSON value
{
"RandomKey1": "3.1.44.0",
"Common": {
"Services": "3.50.103.0",
"Common": "3.50.103.0"
}
}
I want to get the value of RandomKey1. As you may have guessed, the name of the key changes every time when I load the page, so I need to get the value of the 0th key. It is guaranteed to be at the 0th position
I was expecting at least some result with this
cat result.json | jq -r '.[0]'
but instead I get the error
jq: error (at <stdin>:0): Cannot index object with number.
I tried the function keys and it is returning the keys as expected. However there is no values function otherwise I could have obtained the values and return only the first element
cat result.json | jq -r 'keys'
Is there any way to get the 0th value from this string when the key name is unknown ?