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

Empty array become null in json output after with_entries(select(...)) #1880

Closed
linyinfeng opened this issue Nov 22, 2023 · 2 comments
Closed
Labels

Comments

@linyinfeng
Copy link

Describe the bug

Version of yq: 4.40.2
Operating system: linux
Installed via: binary release

Input Yaml
Concise yaml document(s) (as simple as possible to show the bug, please keep it to 10 lines or less)
data.yml:

a: []

Command
The command you ran:

yq eval 'with_entries(select(.key == "a"))' data.yaml --output-format json

Actual behavior

{
  "a": null
}

Expected behavior

{
  "a": []
}
@mikefarah
Copy link
Owner

Hey thanks for raising! That's a nasty bug - will make a new release shortly.

@mikefarah
Copy link
Owner

Fixed in 4.40.3

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