In the JQ Manual, there is an Update-assignment: |= filter and its example.
jq '(..|select(type=="boolean")) |= if . then 1 else 0 end'
Input [true,false,[5,true,[true,[false]],false]]
Output [1,0,[5,1,[1,[0]],0]]
Why this does not produce a JSON stream below but maintains the original nested list format?
1
0
1
1
0
0
For me, (..|select(type=="boolean")) produces:
true
false
true
true
false
false
Then applying |= if . then 1 else 0 end would not produce this?
1
0
1
1
0
0
Please help understand how **|= ** operation maintains can maintain the format of the input.