I have a list from json:
[
{
"id": 1,
"name": "Alice Johnson",
"email": "alice.j@example.com",
"role": "admin",
"active": true
},
{
"id": 2,
"name": "Bob Smith",
"email": "bob84@testmail.org",
"role": "editor",
"active": false
},
{
"id": 3,
"name": "Charlie Davis",
"email": "charlie.d@provider.net",
"role": "viewer",
"active": true
},
{
"id": 4,
"name": "Diana Prince",
"email": "diana.p@workspace.io",
"role": "admin",
"active": true
}
]
Then I found this inconsistent behaviour of group operator, I expect it to return $null since there's no entry with empty key, but the parsed list is always enumerated to a array of nulls?
(Get-Content ./list.json | ConvertFrom-Json)."" -is [array] # true
(Get-Content ./list.json | ConvertFrom-Json)."" | foreach { $_ -eq $null } # all true, array of nulls
(1,2,3)."" -is [array] # False, it's $null