mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Fix ConvertFrom-Json to handle mutlilines
Fix #956 Add Newtonsoft.Json.JsonSerializationException to catch block that determines which mode to use: single-string or multi-string
This commit is contained in:
1 parent
1c9c4f6cf8
commit
3240a2d369
2 files changed
+22
No files matched your search
@@ -0,0 +1,16 @@
|
||||
Describe 'ConvertFrom-Json' {
|
||||
It 'can convert a single-line object' {
|
||||
('{"a" : "1"}' | ConvertFrom-Json).a | Should Be 1
|
||||
}
|
||||
|
||||
It 'can convert one string-per-object' {
|
||||
$json = @('{"a" : "1"}', '{"a" : "x"}') | ConvertFrom-Json
|
||||
$json.Count | Should Be 2
|
||||
$json[1].a | Should Be 'x'
|
||||
}
|
||||
|
||||
It 'can convert mutli-line object' {
|
||||
$json = @('{"a" :', '"x"}') | ConvertFrom-Json
|
||||
$json.a | Should Be 'x'
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user