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

Boolean as string cannot be updated to boolean value #1123

Closed
drfunjohn opened this issue Feb 24, 2022 · 2 comments
Closed

Boolean as string cannot be updated to boolean value #1123

drfunjohn opened this issue Feb 24, 2022 · 2 comments
Labels

Comments

@drfunjohn
Copy link

Describe the bug
A clear and concise description of what the bug is.

Note that any how to questions should be posted in the discussion board and not raised as an issue.

Version of yq: 4.20.2
Operating system: macos 11.6.2
Installed via: homebrew

Input Yaml
data1.yml:

debug: "true" 

Command
The command you ran:

yq eval '.debug = true' -i data1.yml 

Actual behavior
no changes

Expected behavior
boolean value should be set (without quotes: true), instead previously boolean as string (string value: "true"):

debug: true

Additional context
Add any other context about the problem here.

@drfunjohn drfunjohn changed the title Boolean as string cannot be updated boolean value Boolean as string cannot be updated to boolean value Feb 24, 2022
@mikefarah
Copy link
Owner

I am able to replicate this, will fix in the next release.

For now, you can work around the issue by:

yq 'with(.debug; . tag = "!!bool" | . style = "")' -i data1.yml

@drfunjohn
Copy link
Author

Thanx. 👍

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