title: how to parse json response in powershell
body: <p>managed to get the JSON data with </p>
  
  <pre><code>$R= Invoke-WebRequest -Uri $url -Headers $headers -ContentType "application/json"   -Method Get -UseBasicParsing
  $x = $R.Content | Out-String | ConvertFrom-Json 
  </code></pre>
  
  <p>now I've a JSON file like this :</p>
  
  <pre><code>{
    "id": 1000,
    "name_with_namespace": "myProjectName1",
  
  },
  {
    "id": 1001,
    "name_with_namespace": "myProjectName2",
  
  },
  {
    "id": 1002,
    "name_with_namespace": "myProjectName3",
  
  }
  </code></pre>
  
  <p>now I need to extract all the occurence of <code>"name_with_namespace"</code> and <code>"id"</code> where <code>"name_with_namespace" = "myProjectName.*"</code> </p>
  
  <p>How can I do it in one shot?</p>
  
  <p>I've tried this: </p>
  
  <pre><code>foreach ($name in $x.name_with_namespace) {
      if ( $name -match ".*myProjectName.*" ) {    
          write-host "$name - $x.id"               
      }   
  }
  </code></pre>
  
  <p>but I got this: </p>
  
  <pre><code>myProjectName1 1000 1001 1002
  myProjectName2 1000 1001 1002
  myProjectName3 1000 1001 1002
  </code></pre>
  
  <p>I understand that the issue is on $x.id, how can I get the right value instead of everything ? </p>
  
  <p>my expected output is </p>
  
  <pre><code>myProjectName1 1000
  myProjectName2 1001
  myProjectName3 1002
  </code></pre>