I have a json file, its content is:
{
"PID": [
18988,
23928,
16656
],
"Process": [
"pwsh.exe",
"pwsh.exe",
"WindowsTerminal.exe"
],
"WinID": [
"0x1117b6",
"0x130042",
"0x600848"
]
}
I want to import it as a PsCustom
object, I have tried Get-Content -Path c:\temp\MyJson.json|ConvertFrom-Json
but this imports the data as a nested object:
PID Process WinID
--- ------- -----
{18988, 23928, 16656} {pwsh.exe, pwsh.exe, WindowsTerminal.exe} {0x1117b6, 0x130042, 0x600848}
I am expecting the following:
PID Process WinID
--- ------- -----
18988 pwsh.exe 0x1117b6
23928 pwsh.exe 0x130042
16656 WindowsTerminal.exe 0x600848
I have restructured the Json file multiple times, I am not sure where I am going wrong. I am open to changing the json file itself.
I would much rather solve this solution at the json file itself, rather in PowerShell with something like ...ConverFrom-Json| Where-Oject...
, can someone share with me the correct json format to provide for PowerShell, in this case?
Any help would be greatly appreciated!