Closed
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Create a string representing array of arrays with one root element that contains an array of two strings.
Create a string representing array of arrays with two root element that contains an array of two strings each.
Convert them from json. Call them $foo and $bar respectively.
Address $foo's first items first index and assert that it is equal to $bar's first item's first index.
The first index of the first index should be the whole string "abc", however it is collapsing it down to an array of strings, and yielding back the first index of the string e.g. "a"
PS Snippet:
$foo = ConvertFrom-Json '[["abc","def"]]'
$bar = ConvertFrom-Json '[["abc","def"],["ghi","jkl"]]'
$foo[0][0]
$bar[0][0]
$foo[0][0] -eq $bar[0][0]
$foo[0][0] -eq $bar[0][0][0]
$foo[0][0][0] -eq $bar[0][0][0]
Expected behavior
PS> $foo = ConvertFrom-Json '[["abc","def"]]'
>> $bar = ConvertFrom-Json '[["abc","def"],["ghi","jkl"]]'
>>
>> $foo[0][0]
>> $bar[0][0]
>> $foo[0][0] -eq $bar[0][0]
>> $foo[0][0] -eq $bar[0][0][0]
>> $foo[0][0][0] -eq $bar[0][0][0]
abc
abc
True
False
True
Actual behavior
PS> $foo = ConvertFrom-Json '[["abc","def"]]'
>> $bar = ConvertFrom-Json '[["abc","def"],["ghi","jkl"]]'
>> $foo[0][0]
>> $bar[0][0]
>> $foo[0][0] -eq $bar[0][0]
>> $foo[0][0] -eq $bar[0][0][0]
>> $foo[0][0][0] -eq $bar[0][0][0]
a
abc
False
True
True
Error details
No response
Environment data
PS> $PSVersionTable
Name Value
---- -----
PSVersion 7.2.4
PSEdition Core
GitCommitId 7.2.4
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
Image showing behavior in Firefox console behaving as expected just for comparison.