Steps to reproduce
'[ 1, 2 ]' | ConvertFrom-Json | ConvertTo-Json
Expected behavior
Actual behavior
{
"value": [
1,
2
],
"Count": 2
}
I believe the root cause is that ConvertFrom-Json sends arrays as a whole through the pipeline instead of unwrapping them.
Analysis, more examples, and workaround here: http://stackoverflow.com/a/38212718/45375
Environment data
PowerShell v6.0.0-alpha (v6.0.0-alpha.15) on Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
PowerShell v5.1.14393.693 on Microsoft Windows 10 Pro (64-bit; v10.0.14393)