Description
Type of issue
Outdated article
Feedback
-
Test-Json
was switched to usingSystem.Text.Json
to improve JSON schema support, in PR #18141, which took effect in v7.4.0. -
This introduced a problematic asymmetry, in that
Test-Json
now no longer accepts nonstandard JSON (single quotes, barewords, comments), whereas theNewtonSoft.Json
-basedConvertFrom-Json
does; e..g,
'{ foo: 1 }' | ConvertFrom-Json
succeeds (property name is bareword), whereas
'{ foo: 1 }' | Test-Json
now fails. -
For details, see Breaking Change: JSONC no longer works after 7.4.0 PowerShell/PowerShell#20782 (comment).
Note that this massive breaking change was likely unintentional, and at this point there's been no official feedback as to whether the old behavior will (also) be restored.
Therefore:
- The page should state that only strictly conformant JSON is now being recognized as valid by
Test-Json
- The examples should be updated accordingly; e.g.,
"{'name': 'Ashley', 'age': 25}" | Test-Json
no longer passes, due to the use of single quotes.
Page URL
Content source URL
Author
Document Id
2916f68d-0849-3302-7422-918f748aa6d4