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

What is the internal, inverse operation of .[] in jq? or How to construct an array from a group of items, with jq?

$
0
0
echo '[ {"a":1}, {"b":2}, {"c":3} ]' | jq  '.[] | revert_op '

What can we replace revert_op with to get this?

[ {"a":1}, {"b":2}, {"c":3} ]

jq -s '.' does the job, but this is a CLI option, and I want a solution in the flow.

echo '[ {"a":1}, {"b":2}, {"c":3} ]' | jq '.[]' | jq -s '.'

I don't want this solution either:

echo '[ {"a":1}, {"b":2}, {"c":3} ]' | jq '[.[]]'

I want the real opposite operation to ' |.[] '


Viewing all articles
Browse latest Browse all 657

Trending Articles



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