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)

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



  • TFS - Create a branch from local working copy
  • Find unadded files in Team Foundation Server
  • Visual Studio Online, sharing work items, using both Git & TFVC
  • Implementing TFS Pull Requests
  • Nuget packages seems installed after Git checkout of VS2015 solution
  • Migrate from tfs to git on visualstudio.com
  • Creating a Patch with TFS
  • Jenkins: How To Build multiple projects from a TFS repository?
  • 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.