mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
ConvertTo-Json: Serialize BigInteger as a number (#21000)
This commit is contained in:
@@ -146,4 +146,14 @@ Describe 'ConvertTo-Json' -tags "CI" {
|
||||
$t = Add-Member -InputObject $text -MemberType NoteProperty -Name text -Value $text -PassThru
|
||||
$t | ConvertTo-Json -Compress | Should -BeExactly "`"$text`""
|
||||
}
|
||||
|
||||
It 'Should serialize BigInteger values' {
|
||||
$obj = [Ordered]@{
|
||||
Positive = 18446744073709551615n
|
||||
Negative = -18446744073709551615n
|
||||
}
|
||||
|
||||
$actual = ConvertTo-Json -Compress -InputObject $obj
|
||||
$actual | Should -Be '{"Positive":18446744073709551615,"Negative":-18446744073709551615}'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user