We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug try/catch doesn't seem to be working well with field updates.
To Reproduce % echo '{"x":"123"}' | jq -c '.x = (.x | try tonumber catch "error")' {"x":123} % echo '{"x":"123"}' | jq -c '.x |= (try tonumber catch "error")' {"x":"error"}
Environment (please complete the following information): % jq --version jq-1.6
The text was updated successfully, but these errors were encountered:
Seems like a duplicate of #2220 and #2140
Sorry, something went wrong.
And this is already fixed in the master version.
% jq --version jq-master-a17dd32 % echo '{"x":"123"}' | jq -c '.x = (.x | try tonumber catch "error")' {"x":123} % echo '{"x":"123"}' | jq -c '.x |= (try tonumber catch "error")' {"x":123}
jq 1.7 released with the fix.
$ jq --version jq-1.7 $ echo '{"x":"123"}' | jq -c '.x = (.x | try tonumber catch "error")' {"x":123} $ echo '{"x":"123"}' | jq -c '.x |= (try tonumber catch "error")' {"x":123}
closing
No branches or pull requests
Describe the bug
try/catch doesn't seem to be working well with field updates.
To Reproduce
% echo '{"x":"123"}' | jq -c '.x = (.x | try tonumber catch "error")'
{"x":123}
% echo '{"x":"123"}' | jq -c '.x |= (try tonumber catch "error")'
{"x":"error"}
Environment (please complete the following information):
% jq --version
jq-1.6
The text was updated successfully, but these errors were encountered: