title: Filter JSON based on the user input powershell
body: <p>I have user input which is separated by commas and I am using split function to get different values. I have an API that returns some data in JSON. I want to filter data from API Json based on the user input</p>
  <p>Powershell code</p>
  <pre><code>#Get Input data
  $GetIds = Read-Host -Prompt 'Enter Ids:'
  
  #Example 1,2
  #If they enter 1,2, I want results data of John and Mark
  #API Call Data
  $json = @'
  {  
      &quot;results&quot;: [
          {
              &quot;id&quot;: &quot;1&quot;, 
               &quot;name&quot;: &quot;John&quot;,           
          }, 
          {
               &quot;id&quot;: &quot;2&quot;, 
               &quot;name&quot;: &quot;Mark&quot;,  
          },
          {
               &quot;id&quot;: &quot;3&quot;, 
               &quot;name&quot;: &quot;Rachel&quot;,  
          }
      ]
  }
  '@
  
  $Obj = ConvertFrom-Json $json
  
  #Split by comma
  
  $userInputData = -split $GetIds 
  
  #Filter json with $userInputData 
  $FilteredData = $json | Where-Object { $_.id -eq #loop through $userInputData }
  </code></pre>
  <p>I want the filtered data to return $json filtered by the userInput data. Thank you</p>