title: Postman get value from JSON where equals a value in array using javascript
body: <p>Currently using the latest version of Postman: 6.7.4 (Latest) </p>
  
  <p>I'm trying to get a value out of a JSON response body and store it in an environment variable BUT the value 'username' should be equal to my preferred username.</p>
  
  <p>Normally I would extract a value like this:</p>
  
  <pre><code>var jsonData = pm.response.json();
  pm.environment.set("useridToken", jsonData.Customers[0].userid);
  </code></pre>
  
  <p>This would give me the first item in the list but I do <strong>not</strong> wish to obtain the first nor the second item from the list. I wish to obtain the <code>userid</code> <strong>where</strong> <code>username</code> <strong>EQUAL</strong> "Billy" for example. </p>
  
  <p>Output of the body response:</p>
  
  <pre><code>{
  "Customers": [
      {
          "id": 24,
          "userid": 73063,
          "username": "BOB",
          "firstname": "BOB",
          "lastname": "LASTNAME
      },
      {
          "id": 25,
          "userid": 73139,
          "username": "Billy",
          "firstname": "Billy",
          "lastname": "lasty"
      }
     ]
  }
  </code></pre>
  
  <p>Any tips?</p>
  
  <p>I remember in SoapUI it was like this: </p>
  
  <pre><code>$.channels[?(@.is_archived=='false')].id[0]
  </code></pre>
  
  <p>I guess it's not possible to do this in JS in Postman?</p>