Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 528

Strange behaviour of the alternative operator //

$
0
0

Using JQ 1.5 I've problems understanding the output of the alternative operator // in a specific situation.

Given this input:

{"a": 42,"b": false,"c": null}

I expected the expression (.a, .b, .c, .d) // -1 to return this:

42-1-1-1

But in fact it returns this instead:

42

If I replace // with another operator like < then I indeed get four results instead of just one (the actual results are not important here, just their number):

> jq '(.a, .b, .c, .d) < -1' input.jsonfalsetruetruetrue

Note: The expression (.a, .b, .c, .d) | . // -1 returns the expected output. This is not the question. I'd like to know why the initial expression does not work.


Viewing all articles
Browse latest Browse all 528

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>