I had a look around but I cannot find anything that helped, here my problem, I have a bash script that make a curl query and get a json, that look like that:
{
"user1": {
"email": "[email protected]",
"shell": "/usr/local/bin/bash",
"status": "ACTIVE",
"userId": "user1",
"homeDir": "/home/user1",
"unixUid": 123456,
"accesses": [
"computer1"
],
"personId": 1234,
"isPrimary": true,
"projectGroupIds": [
"bigproj"
],
"primaryProjectGroupId": "bigproj"
},
"user2": {
"email": "[email protected]",
"shell": "/usr/local/bin/bash",
"status": "ACTIVE",
"userId": "user2",
"homeDir": "/home/user2",
"unixUid": 9876564,
"accesses": [
"computer1"
],
"personId": 5678,
"isPrimary": true,
"projectGroupIds": [
"smallporj"
],
"primaryProjectGroupId": "smallproj"
...
What I need to do is to create a list, that contains:
UserId: user1 email: [email protected]
UserId: user2 email: [email protected]
UserId: user3 email: [email protected]
...
My problem is that the username key, is basically always changing and it doesn't have a fix key name. The top key types are:
jq -c 'to_entries[] | [.key, (.value|type)]'
["meta","object"]
["body","object"]
So what should be the best approach to create a list that I'll need to compare with another one? Thanks in advance.