Parsing JSON w/ PS

Welcome Forums General PowerShell Q&A Parsing JSON w/ PS

This topic contains 2 replies, has 3 voices, and was last updated by

7 months ago.

  • Author
  • #112151

    Topics: 1
    Replies: 0
    Points: 0
    Rank: Member

    I think this code looks convoluted and messy... and I like clean code 🙂 My question, to paraphrase one of my favorite films is: "is this as good as it gets?"

  • #112159

    Topics: 2
    Replies: 392
    Points: 667
    Helping Hand
    Rank: Major Contributor

    There are a few ways to write it, but with an object structured in that fashion, that's about it. A more pipelined version might be something like this:

    $Json | ConvertFrom-Json |
        ForEach-Object {
            foreach ($Name in $_.Value.PSObject.Properties.Name) {
                    Name = $Name
                    Days_Remaining = $_.$Name.Days_Remaining
  • #112163

    Topics: 1
    Replies: 5
    Points: 2
    Rank: Member



The topic ‘Parsing JSON w/ PS’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort