Powershell – Getting multiple values from a nested object

I am sure this is a very basic PowerShell question but I have a JSON file that I am loading into a PowerShell custom object with ConvertFrom-Json and the following select-object works

$JsonContent.value | Select-Object -Property Name, @{Name = 'commit'; Expression = { $_.commit.author.date }}

I am trying to get another column in the nested commit object and the following is NOT working so am hoping someone can help me figure out how to get a second value from the nested commit object (I have tried a few variations but not working)

  • Git: duplicate commits after local rebase, then pull
  • deleted a file in local master branch, how do I get it back from the remote?
  • Git instaweb with multiple repositories not working
  • How do I create an “origin” repository for an exisiting project in Visual Studio 2015?
  • Working while waiting for pending PR
  • Is it possible to create a git hash object outside a git directory?
  • JsonContent.value | Select-Object -Property Name, @{Name = 'commit'; Expression = { $_.commit.author.date}, {$_.commit.commitId}}



  • Paperclip files get deleted after each deploy
  • How can I explain source control (Mercurial/Tortoise specifically) to a non-programmer?
  • How to share the git commit log with the customer without giving access to the repository?
  • Is it rude to commit design documents to github?
  • Number of files in a GitHub repository
  • Strange error while trying to clone a SVN repo via git
  • One Solution collect form web for “Powershell – Getting multiple values from a nested object”

    The part after Expression = ... is a script block containing code so if you want to return an array of values there for being the value for the property commit then just modify

    Expression = { $_.commit.author.date}, {$_.commit.commitId}  


    Expression = { $_.commit.author.date, $_.commit.commitId}

    so that you use the commma operator to create and return your 2-element array

    Probably you rather want to make some nice string representing the commit e.g.

    Expression = { "{0} - {1}" -f $_.commit.author.date, $_.commit.commitId }

    In case you want the commitId in a completely different column just add another property like so

    ... -Property Name, @{Name = 'commit'; Expression = { $_.commit.author.date}}, @{Name = 'commitId'; Expression = {$_.commit.commitId}} 
    Git Baby is a git and github fan, let's start git clone.