Using try or ? on the RHS of the |= operator removes the path being updated, even if the update expression works correctly without any error handling.
I'm using jq-1.6rc1-1-g61edf3f
Example program:
{"number":"1234"}|(.number|=23),(.number|=23?)
Expected output:
{
"number": 23
}
{
"number": 23
}
Actual output:
{
"number": 23
}
{}
jq 1.5 behaves as expected.
Thanks for the report.
This issue is still present in stable release jq-1.6.
I've tried following test cases:
{"price": "$23,000"} | .price |= (try 2 catch null)
{"price": null} # expected 2
The output is correct If update operator or try-catch is removed:
{"price": "$23,000"} | . + {price: (try 2 catch null)}
{ "price": 2}
{"price": "$23,000"} | .price |= 2
{ "price": 2}
Jq-1.5 works as expected. Is there any update on this issue? Is it related to the documented change of behavior of update operator?
Fixed by @wtlangford with e74eab8.
Most helpful comment
This issue is still present in stable release
jq-1.6.I've tried following test cases:
{"price": "$23,000"} | .price |= (try 2 catch null){"price": null} # expected 2The output is correct If update operator or try-catch is removed:
{"price": "$23,000"} | . + {price: (try 2 catch null)}{ "price": 2}{"price": "$23,000"} | .price |= 2{ "price": 2}Jq-1.5 works as expected. Is there any update on this issue? Is it related to the documented change of behavior of update operator?