Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

ConvertFrom-Json and Test-Json accept non-compliant/non-standard JSON - no way to strictly validate JSON #10628

Copy link
Copy link
@chriskuech

Description

@chriskuech
Issue body actions

Summary of the new feature/enhancement

There does not seem to be any way to validate whether a JSON string is valid, which makes it impossible to use PowerShell to validate JSON before passing it to another application.

For example, the following JSON is invalid due to the trailing comma, but Test-Json still returns $true.

'{"hello": "world",}' | Test-Json

I propose adding a -Strict parameter to Test-Json for testing that the JSON string adheres strictly to the JSON specification.

Side note

I was very excited when I found the Test-Json cmdlet, but so far every use case it would have helped, it has not behaved as expected. See also #9560. If this cannot be implemented using the current library, please strongly consider using Json.NET instead of NJsonSchema.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility moduleWaiting - DotNetCorewaiting on a fix/change in .NETwaiting on a fix/change in .NET

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.