I have a json file GroupList.json:
{
"results": [
{
"type": "known",
"username": "USERID1",
"displayName": "DISPLAYNAME1",
"_links": {
"self": "https://confluence.com/rest/api/user?key=123"
},
"_expandable": {
"status": ""
}
},
{
"type": "known",
"username": "USERID2",
"displayName": "DISPLAYNAME2",
"_links": {
"self": "https://confluence.com/rest/api/user?key=1234"
},
"_expandable": {
"status": ""
}
}
],
"start": 0,
"limit": 50000,
"size": 2,
"_links": {
"self": "https://confluence.com/rest/api/group/GROUPNAME/member",
"base": "https://confluence.com"
}
}
I'm fetching the username using the below command: jq -r '.results | map(.username) | join(",")' GroupList.json > UserNameList.txt
Output in UserNameList.txt is: USERID1,USERID2
I want to modify the output to be:
SPACEKEY : GROUPNAME : USERID1,USERID2
SPACEKEY & GROUPNAME are 2 variables whose value changes in every iteration.