Describe the bug
Extracting object values by iterating via keys causes missing items, see the example below:
Version of yq: 4.45.2
Operating system: mac
Installed via: homebrew
Command
The command you ran:
echo '["a","b"]' | yq '. as $o | keys[] | $o[.]'
Actual behaviour
Expected behaviour
Additional context
The problem appears to be related to the $o[.] part, somehow it only produced the value of the first key (index 0).
However, it works when iterating over keys[] with an intermediate variable, e.g.:
echo '["a","b"]' | yq '. as $o | keys[] | . as $k | $o[$k]'
echo '["a","b"]' | yq '. as $o | keys[] | . as $k | $o[.]' ## $k is not even used
Both would produce the expected result mentioned above.
Describe the bug
Extracting object values by iterating via keys causes missing items, see the example below:
Version of yq: 4.45.2
Operating system: mac
Installed via: homebrew
Command
The command you ran:
Actual behaviour
aExpected behaviour
Additional context
The problem appears to be related to the
$o[.]part, somehow it only produced the value of the first key (index0).However, it works when iterating over
keys[]with an intermediate variable, e.g.:echo '["a","b"]' | yq '. as $o | keys[] | . as $k | $o[$k]'echo '["a","b"]' | yq '. as $o | keys[] | . as $k | $o[.]'##$kis not even usedBoth would produce the expected result mentioned above.