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 doesn't unwrap arrays on output, resulting in an extraneous wrapper JSON object with Count and Value properties on reconversion #3153

Copy link
Copy link
@mklement0

Description

@mklement0
Issue body actions

Steps to reproduce

'[ 1, 2 ]' | ConvertFrom-Json | ConvertTo-Json

Expected behavior

[
    1,
    2
]

Actual behavior

{
    "value":  [
                  1,
                  2
              ],
    "Count":  2
}

I believe the root cause is that ConvertFrom-Json sends arrays as a whole through the pipeline instead of unwrapping them.

Analysis, more examples, and workaround here: http://stackoverflow.com/a/38212718/45375

Environment data

PowerShell v6.0.0-alpha (v6.0.0-alpha.15) on Darwin Kernel Version 16.4.0: Thu Dec 22 22:53:21 PST 2016; root:xnu-3789.41.3~3/RELEASE_X86_64
PowerShell v5.1.14393.693 on Microsoft Windows 10 Pro (64-bit; v10.0.14393)
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-FixedThe issue is fixed.The issue is fixed.WG-Cmdlets-Utilitycmdlets in the Microsoft.PowerShell.Utility modulecmdlets in the Microsoft.PowerShell.Utility module

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    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.