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

How to extract a field from each object in an array with jq?

$
0
0

I performed a cURL request to get all the users in our Gitlab server, like this.

$ curl -H "Private-Token: a;sldkfja;slkdfj" https://gitlab.domain.com/api/v3/users?active=true > my_file.json

and (part of) my_file.json looks like:

[  {"username" : "jdoe","name" : "John Doe",    ...  },  {"username" : "jadoe","name" : "Jane Doe",    ...  }]

I stored the response in my_file.json. How can I use jq to get all the username values?

$ cat my_file.json | jq -r 'what to put here?'

Viewing all articles
Browse latest Browse all 612

Trending Articles



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