Skip to content

Test-Json doesn't recognize JSON arrays or primitives #11384

@mklement0

Description

@mklement0

Steps to reproduce

'42' | Test-Json | Should -BeTrue
'[ 1, 2 ]' | Test-Json | Should -BeTrue

Expected behavior

The tests should succeed, given that these are valid JSON strings and that piping them to ConvertFrom-Json works just fine:

# These tests pass.
'42' | ConvertFrom-Json | Should -Be 42
'[ 1, 2 ]' | ConvertFrom-Json | Should -Be 1, 2

Actual behavior

Both tests fail.

Environment data

PowerShell Core 7.0.0-rc.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-FixedThe issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions