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

Using jq to parse and display multiple fields in a json serially

$
0
0

I have this Json

{"users": [        {"first": "Stevie","last": "Wonder"        },        {"first": "Michael","last": "Jackson"        }    ]}

Using jq I'd like to display first and last name serially. Like so -

Stevie WonderMichael Jackson

This is how far I have gotten -

jq '.users[].first, .users[].last'

But it displays

"Stevie""Michael""Wonder""Jackson"

Notice the following:

  1. The double quotes that I do not want.
  2. The carriage return that I do not want.
  3. It's jumbled up. My query displays all the first names first, and then all the last names. However, I want first-last, first-last pair.

Viewing all articles
Browse latest Browse all 657

Trending Articles



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