-
-
Notifications
You must be signed in to change notification settings - Fork 738
Open
Description
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
aExpected behaviour
a
bAdditional 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[.]'##$kis not even used
Both would produce the expected result mentioned above.