I recommend using String Interpolation:
jq '.users[] | "\(.first) \(.last)"'
We are piping down the result of .users[]
to generate the string “.first .last” using string interpolation. \(foo)
syntax is used for string interpolation in jq
. So, for the above example, it becomes “Stevie Wonder” (".users[].first .users[].second"
working elementwise) and “Michael Jackson”.
jq reference: String interpolation