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?'
$ jq -r '.[].username' my_file.json jdoe jadoe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With