Remove pre-parse for array-based JSON (#15684)

This commit is contained in:
William Easton
2022-07-25 14:14:56 -07:00
committed by GitHub
parent 3d4e294262
commit ec0dba4605
2 changed files with 9 additions and 17 deletions
@@ -58,7 +58,15 @@ Describe 'ConvertFrom-Json Unit Tests' -tags "CI" {
$json | Should -BeOfType Hashtable
}
}
It 'Throws an ArgumentException with an incomplete array with AsHashtable switch set to <AsHashtable>' -TestCase $testCasesWithAndWithoutAsHashtableSwitch {
Param($AsHashtable)
{ ConvertFrom-Json '["1",' -AsHashtable:$AsHashtable } |
Should -Throw -ErrorId "System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand"
{ ConvertFrom-Json '[' -AsHashtable:$AsHashtable } |
Should -Throw -ErrorId "System.ArgumentException,Microsoft.PowerShell.Commands.ConvertFromJsonCommand"
}
It 'Can convert multi-line object with AsHashtable switch set to <AsHashtable>' -TestCases $testCasesWithAndWithoutAsHashtableSwitch {
Param($AsHashtable)
$json = @('{"a" :', '"x"}') | ConvertFrom-Json -AsHashtable:$AsHashtable