title: How do I remove an entry from my JSON Object?
body: <pre><code># helper to turn PSCustomObject into a list of key/value pairs
  function Get-ObjectMembers {
      [CmdletBinding()]
      Param(
          [Parameter(Mandatory=$True, ValueFromPipeline=$True)]
          [PSCustomObject]$obj
      )
      $obj | Get-Member -MemberType NoteProperty | ForEach-Object {
          $key = $_.Name
          [PSCustomObject]@{Key = $key; Value = $obj."$key"}
      }
  }
  
  $entry = [PSCustomObject]@{
      PostedDate = "04/18/2018"
      JobTitle = "King"
      Street = "Bloor"
      City = "Toronto"
      DocumentURL = "../path/to/file.pdf"
  }
  
  
  
  $path = "A:\path\to\file.json"
  $entry = Get-Content $path | ConvertFrom-Json
  
  $entry
  
  $today = (Get-Date).ToString('MM/dd/yyyy')#Get-Date -Date -format MM/dd/yyyy
  $today = [datetime]::ParseExact($today, "MM/dd/yyyy", [System.Globalization.CultureInfo]::CurrentCulture)
  
  foreach($date in $entry.Closing)
  {
      $newdate = Get-Date $date.ToString()
      $newdate = $newdate.ToString('MM/dd/yyyy')
      $newdate = [datetime]::ParseExact($newdate, "MM/dd/yyyy", [System.Globalization.CultureInfo]::CurrentCulture)
  
      if($today -gt $newdate)
      {
          Write-Host $date
          #remove element from the JSON list
      }
  }
  </code></pre>
  
  <p>I can't figure out how I can remove an element from the JSON Object and save a copy of the removed items as a different  JSON file</p>
  
  <p>I am using PowerShell 5.1 on Windows 10</p>