Title: Serializing bigint value to JSON emits incorrect JSON · Issue #20989 · PowerShell/PowerShell · GitHub
Open Graph Title: Serializing bigint value to JSON emits incorrect JSON · Issue #20989 · PowerShell/PowerShell
X Title: Serializing bigint value to JSON emits incorrect JSON · Issue #20989 · PowerShell/PowerShell
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 reprodu...
Open Graph 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 PowerSh...
X 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 PowerSh...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/20989
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Serializing bigint value to JSON emits incorrect JSON","articleBody":"### Prerequisites\r\n\r\n- [X] Write a descriptive title.\r\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\r\n- [X] Search the existing issues.\r\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\r\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\r\n\r\n### Steps to reproduce\r\n\r\n```ps1\r\nPS\u003e $i = [bigint]\"93839802329326\"\r\nPS\u003e $obj = @{\"val\" = $i}\r\nPS\u003e ConvertTo-Json $obj \r\n\r\n{\r\n \"val\": {\r\n \"IsPowerOfTwo\": false,\r\n \"IsZero\": false, \r\n \"IsOne\": false, \r\n \"IsEven\": true,\r\n \"Sign\": 1\r\n }\r\n}\r\n```\r\n\r\n\r\nNote that casting the variable inline as `[int64]` does work correctly:\r\n\r\n```ps1\r\nPS\u003e $i = [bigint]\"93839802329326\"\r\nPS\u003e $obj = @{\"val\" = [int64]$i}\r\nPS\u003e ConvertTo-Json $obj \r\n{\r\n \"val\": 93839802329326\r\n}\r\n```\r\n\r\nand casting the variable inline as `[bigint]` does not:\r\n\r\n```ps1\r\nPS\u003e $i = [bigint]\"93839802329326\"\r\nPS\u003e $obj = @{\"val\" = [bigint]$i}\r\nPS\u003e ConvertTo-Json $obj \r\n{\r\n \"val\": {\r\n \"IsPowerOfTwo\": false,\r\n \"IsZero\": false,\r\n \"IsOne\": false,\r\n \"IsEven\": true,\r\n \"Sign\": 1\r\n }\r\n}\r\n```\r\n\r\n### Expected behavior\r\n\r\n```console\r\n{\r\n \"val\": 93839802329326\r\n}\r\n```\r\n\r\n\r\n### Actual behavior\r\n\r\n```console\r\n{\r\n \"val\": {\r\n \"IsPowerOfTwo\": false,\r\n \"IsZero\": false, \r\n \"IsOne\": false, \r\n \"IsEven\": true,\r\n \"Sign\": 1\r\n }\r\n}\r\n```\r\n\r\n\r\n### Error details\r\n\r\n_No response_\r\n\r\n### Environment data\r\n\r\n```powershell\r\nName Value\r\n---- -----\r\nPSVersion 7.4.0\r\nPSEdition Core\r\nGitCommitId 7.4.0\r\nOS Microsoft Windows 10.0.19045\r\nPlatform Win32NT\r\nPSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}\r\nPSRemotingProtocolVersion 2.3\r\nSerializationVersion 1.1.0.1\r\nWSManStackVersion 3.0\r\n\r\n```\r\n\r\n\r\n### Visuals\r\n\r\n_No response_","author":{"url":"https://github.com/argium","@type":"Person","name":"argium"},"datePublished":"2024-01-03T01:47:10.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/20989/PowerShell/issues/20989"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d3f4c16b-e7a7-40b8-1c29-7e8e4533e855 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E932:2BA6B2:274CB85:38C0479:6A567313 |
| html-safe-nonce | 45adb43cb8e68709ea8cedddc8b2af5214741f0f5ede5a0573ede716321248e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOTMyOjJCQTZCMjoyNzRDQjg1OjM4QzA0Nzk6NkE1NjczMTMiLCJ2aXNpdG9yX2lkIjoiMjAxMDU3OTI1NjUzMTY0NTIwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | ff0448fa94f73218572c0450967591d49ad184196f36c5bc71a1f2f9971bf23a |
| hovercard-subject-tag | issue:2063141824 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/20989/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4ce63f09cc637eee9201f56c38d542db5f85b7625acd20061f3c470132f6fe41/PowerShell/PowerShell/issues/20989 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4ce63f09cc637eee9201f56c38d542db5f85b7625acd20061f3c470132f6fe41/PowerShell/PowerShell/issues/20989 |
| og:image:alt | 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 PowerSh... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | argium |
| hostname | github.com |
| expected-hostname | github.com |
| None | 19b5ee9431dcfce15ab4b001d626e4e3a6ba1acb7be814813a52bbebd9a86ef5 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | afc01ffdb045f4ff81c6122091366ade7b6166b7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width