-
Notifications
You must be signed in to change notification settings - Fork 41
Open
Description
Hi, first off thanks for creating jackson-jq, it is great.
I encountered this case where jackson-jq behaves differently than jq
>> jq --version
jq-1.6
>> echo '{"a": 1, "b": 2}' | jq -c '{"x": 10} + . as {"a": $a} | {"y": $a}'
{"x":10,"y":1}
>> echo '{"a": 1, "b": 2}' | java -jar /tmp/jackson-jq-cli-0.0.12.jar -c '{"x": 10} + . as {"a": $a} | {"y": $a}'
{"y":1}
I suspect the problem lies in difference operator precedence than jq has as when quoted like this, the output matches that of jq
>> echo '{"a": 1, "b": 2}' | java -jar /tmp/jackson-jq-cli-0.0.12.jar -c '{"x": 10} + (. as {"a": $a} | {"y": $a})'
{"x":10,"y":1}
The example seems contrived but I tried to use similar construct with real data when I encountered this problem and after some investigation this was the simplest example I could shrink it down to.