Title: Breaking Change: JSONC no longer works after 7.4.0 · Issue #20782 · PowerShell/PowerShell · GitHub
Open Graph Title: Breaking Change: JSONC no longer works after 7.4.0 · Issue #20782 · PowerShell/PowerShell
X Title: Breaking Change: JSONC no longer works after 7.4.0 · Issue #20782 · 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/20782
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Breaking Change: JSONC no longer works after 7.4.0","articleBody":"### Prerequisites\n\n- [X] Write a descriptive title.\n- [X] Make sure you are able to repro it on the [latest released version](https://github.com/PowerShell/PowerShell/releases)\n- [X] Search the existing issues.\n- [X] Refer to the [FAQ](https://github.com/PowerShell/PowerShell/blob/master/docs/FAQ.md).\n- [X] Refer to [Differences between Windows PowerShell 5.1 and PowerShell](https://learn.microsoft.com/powershell/scripting/whats-new/differences-from-windows-powershell).\n\n### Steps to reproduce\n\nInclude a comment in json, one example can be seen here:\r\n\r\n```\r\n'{\r\n // A Json comment\r\n \"string\": \"test\"\r\n}' | Test-Json\r\n```\r\n\r\nIn previous versions of PS this worked as expected. \n\n### Expected behavior\n\n```console\nPS\u003e '{\r\n // A Json comment\r\n \"string\": \"test\"\r\n}' | Test-Json\r\nTrue\n```\n\n\n### Actual behavior\n\n```console\nPS\u003e '{\r\n // A Json comment\r\n \"string\": \"test\"\r\n}' | Test-Json\r\n\r\nTest-Json: Cannot parse the JSON\n```\n\n\n### Error details\n\n```console\nException : \r\n Type : System.Exception\r\n Message : Cannot parse the JSON.\r\n InnerException : \r\n Type : System.Text.Json.JsonReaderException\r\n LineNumber : 1\r\n BytePositionInLine : 4\r\n Message : '/' is invalid after a value. Expected either ',', '}', or ']'. LineNumber: 1 | BytePositionInLine: 4.\r\n TargetSite : \r\n Name : ThrowJsonReaderException\r\n DeclaringType : System.Text.Json.ThrowHelper, System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51\r\n MemberType : Method\r\n Module : System.Text.Json.dll\r\n Source : System.Text.Json\r\n HResult : -2146233088\r\n StackTrace : \r\n at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader\u0026 json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)\r\n at System.Text.Json.Utf8JsonReader.ConsumeNextToken(Byte marker)\r\n at System.Text.Json.Utf8JsonReader.ConsumeNextTokenOrRollback(Byte marker)\r\n at System.Text.Json.Utf8JsonReader.ReadSingleSegment()\r\n at System.Text.Json.Utf8JsonReader.Read()\r\n at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, JsonReaderOptions readerOptions, MetadataDb\u0026 database, StackRowStack\u0026 stack)\r\n at System.Text.Json.JsonDocument.ParseUnrented(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, JsonTokenType tokenType)\r\n at System.Text.Json.JsonDocument.ParseValue(ReadOnlyMemory`1 json, JsonDocumentOptions options)\r\n at System.Text.Json.Nodes.JsonNode.Parse(String json, Nullable`1 nodeOptions, JsonDocumentOptions documentOptions)\r\n at Microsoft.PowerShell.Commands.TestJsonCommand.ProcessRecord()\r\n HResult : -2146233088\r\nTargetObject : {\r\n // A Json comment\r\n \"string\": \"test\"\r\n}\r\nCategoryInfo : InvalidData: ({\r\n // A Json com… \"string\": \"test\"\r\n}:String) [Test-Json], Exception\r\nFullyQualifiedErrorId : InvalidJson,Microsoft.PowerShell.Commands.TestJsonCommand\r\nInvocationInfo : \r\n MyCommand : Test-Json\r\n ScriptLineNumber : 4\r\n OffsetInLine : 6\r\n HistoryId : 4\r\n Line : }' | Test-Json\r\n Statement : Test-Json\r\n PositionMessage : At line:4 char:6\r\n + }' | Test-Json\r\n + ~~~~~~~~~\r\n InvocationName : Test-Json\r\n CommandOrigin : Internal\r\nScriptStackTrace : at \u003cScriptBlock\u003e, \u003cNo file\u003e: line 1\r\nPipelineIterationInfo :\n```\n\n\n### Environment data\n\n```powershell\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\n```\n\n\n### Visuals\n\n\r\n\r\n","author":{"url":"https://github.com/kyle-ntx","@type":"Person","name":"kyle-ntx"},"datePublished":"2023-11-27T01:37:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":21},"url":"https://github.com/20782/PowerShell/issues/20782"}
| 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:7dd23474-ea9e-939f-d2da-f5618eaaff57 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E98A:2BEEEA:EDEE4A:1423F01:6A5567CE |
| html-safe-nonce | 378d76f2dc6844edbe289d441e4a6d6a160eec9d4402f6c535092ebedc155654 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOThBOjJCRUVFQTpFREVFNEE6MTQyM0YwMTo2QTU1NjdDRSIsInZpc2l0b3JfaWQiOiIzMDYzMjE1Mjc1MTA3NTUyNzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9ad35983212b032e5dad3b4444f0aab13e99bcf6881602c92523047cbaa4a5ce |
| hovercard-subject-tag | issue:2011331982 |
| 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/20782/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5956af0b94ad5f88edc351e9971ee11049f0a3d51a4cdda31d0d8e60c5f8509b/PowerShell/PowerShell/issues/20782 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5956af0b94ad5f88edc351e9971ee11049f0a3d51a4cdda31d0d8e60c5f8509b/PowerShell/PowerShell/issues/20782 |
| 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 | kyle-ntx |
| hostname | github.com |
| expected-hostname | github.com |
| None | b5665c84831ed9ac4fb79519c16c9c5580ba8092fb8bb6e3e72972ec7197348e |
| 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 | 8201d0b7bc32164c4662de52242e463a356df543 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width