Very beginner question. I'm trying to get certain values from JSON with Powershell.. Specifically, I want to list the Services: TEST00000 and FAKE only.
When I run the script below, I get this:
TEST00000 FAKE
--------- ----
@{Enabled=True; Processed=2; Sent=3; Failed=4; Downloaded=5} @{Enabled=True}
How can I get a list of only the services?
More importantly, how do I list only the services which has the key/value Enabled=True present inside of them?
Here is the code:
$JSON = '{
"Envs": {
"DEV": {
"Services": {
"TEST00000": {
"Enabled": true,
"Processed": 2,
"Sent": 3,
"Failed": 4,
"Downloaded": 5
},
"FAKE": {
"Enabled": true
}
}
}
},
"Component": {
"Digger": {
"Envs": {
"DEV": {
"DownloadE": 4
}
}
}
}
}'
$jsonobj = ConvertFrom-Json -inputObject $JSON
$jsonobj.Envs.DEV.Services