Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pick does not work if input is xml #1284

Closed
balki opened this issue Jul 28, 2022 · 3 comments
Closed

pick does not work if input is xml #1284

balki opened this issue Jul 28, 2022 · 3 comments
Labels

Comments

@balki
Copy link

balki commented Jul 28, 2022

Version of yq: 4.26.1
Operating system: linux
Installed via: snap

Input XML

ex.xml:

<feed>
  <entry>
    <id>b9a1ef89</id>
    <title> Added NDJSON decoder (#1281) </title>
  </entry>
  <entry>
    <id>c2c48bbe</id>
    <title> Bumping version </title>
  </entry>
</feed>

Command

❯ cat ex.xml | yq -p xml '.feed.entry[] |= pick(["title"])' 
Error: cannot pick indicies from type  (feed.entry.0)

But this works:

❯ cat ex.xml | yq -p xml . | yq '.feed.entry[] |= pick(["title"])'
feed:
  entry:
    - title: Added NDJSON decoder (#1281)
    - title: Bumping version
@mikefarah
Copy link
Owner

Thanks for raising, I can replicate this issue - will have a fix next release

mikefarah added a commit that referenced this issue Jul 29, 2022
@balki
Copy link
Author

balki commented Jul 29, 2022

Great! Thanks

@mikefarah
Copy link
Owner

Fixed in 4.27.1 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants