I have a json output from an api call, which partially looks like as below. As part of this json, there are many id and name values listed..Now, I want to capture id and name pair together as an array , as part of some steps in the program I get returned with name , I want to compare this name with the name stored in array previously and return the id value corresponding to it. As I have to pass this id value to another rest api call.
Could someone help how can I capture this array through powershell?
$Json = '{
"value": [
{
"id": "1",
"name": "datafactory.git",
"size": 0,
"remoteUrl": "",
"sshUrl": "",
"webUrl": "",
"isDisabled": false
},
{
"id": "2",
"name": "datafactory",
"defaultBranch": "refs/heads/main",
"size": 13569,
"remoteUrl": "",
"sshUrl": "",
"webUrl": "",
"isDisabled": false
},
]
}'
ConvertFrom-Jsonto get your Json into powershell objects and go from there.