What version of PowerShell are you running? With the latest version of WMF5 on Windows 10, I’m not seeing a problem when I tried to reproduce this, but I do remember there being some headaches with the JSON serializer in PSv4:
$json = @'
{
"host_cpus": 40,
"host_sn": "8XXXXX2",
"hostname": "ESXI-01.company.local",
"vms": [
{
"memory": "16384",
"name": "DC-01"
},
{
"memory": "8192",
"name": "test-centos"
}
]
}
'@
$json | ConvertFrom-Json | ConvertTo-Json -Depth 2
<#
{
"host_cpus": 40,
"host_sn": "8XXXXX2",
"hostname": "ESXI-01.company.local",
"vms": [
{
"memory": "16384",
"name": "DC-01"
},
{
"memory": "8192",
"name": "test-centos"
}
]
}
#>