-
Notifications
You must be signed in to change notification settings - Fork 835
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
Tilde operator treats values other than true and 1 as false #327
Comments
This commit fixes an issue with ~false where the it's value was simply the opposite of ~true. Now ~false explicitly checks for false-ish values. Also added ~null and ~* for testing null-ish and non-existent values. see #327
In your case, gjson is simply treating I agree that this is probably not desired. Rather, we likely want to more explicit, where all true-ish values are true, and all false-ish are false. I made some updates moments ago to the syntax that addresses the Now I also added two more tilde types:
Yes, using
|
Great! Just tried and it works like a charm! |
No problem. I'm happy to hear it's working. :) |
I tested
vals.#(b==~false)#.a
with the example provided:And it gives the desired result:
[3,4,5,9,10,11]
However, when we have values other than true or 1, they are treated as false:
Gives:
[1,2,3,4,5,9,10,11]
Try: https://go.dev/play/p/ey6dS3zFk3p
I don't this is the desired behavior.
Is there a way to get the fields, for which the data is either null or missing?
The text was updated successfully, but these errors were encountered: