title: Postman test to find a keyword in a response array
body: <p>I am creating a test in postman to check for a keyword "pregnancy" in each "name" field in the JSON. If each 'name' field in the JSON contains the keyword then pass the test, else fail.</p>
  
  <p>Find the script below that I have tried using</p>
  
  <pre><code>var jsonData = pm.response.json(); 
  
  var resultCount = jsonData.length;
  for (i=0;i&lt;resultCount;i++){
      var modelString = jsonData[i].name;
      if(modelString.indexOf("Pregnancy") &gt; 0)
      {
         tests["Each organisation name field " +i+ " contains   \"Pregnancy\""] = modelString.has("Pregnancy");
      }
      else
      {
         pm.expect.fail("failed");
      }
  }
  console.log("")
  
  [
      {
          "id": "1-116992830",
          "name": "British Pregnancy Advisory Service      (BPAS)",
          "numberOfLocations": 78
      },
      {
          "id": "1-1560082724",
          "name": "PAMS Pregnancy Ultrasound Centre      (PAMS 3D &amp;     4D Baby Imaging)",
          "numberOfLocations": 1
      },
      {
          "id": "1-2458518720",
          "name": "Pregnancy Ultrasound Ltd      (Babyface4d)",
          "numberOfLocations": 1
      },
      {
          "id": "1-101728376",
          "name": "National Unplanned Pregnancy Advisory Service     Limited",
          "numberOfLocations": 23
      },
      {
          "id": "1-3578030817",
          "name": "Private Pregnancy Ultrasound Services Ltd trading as Expectancy Scanning Studios Ltd      (Expectancy Scanning Studios Ltd)",
          "numberOfLocations": 2
      },
      {
          "id": "1-1412821832",
          "name": "Foundation For Life (Salisbury)      (Pregnancy Advice Salisbury)",
          "numberOfLocations": 1
      },
      {
          "id": "1-2028907839",
          "name": "Miscarriage Clinic Limited      (Centre for     Reproductive Immunolgy and Pregnancy)",
          "numberOfLocations": 1
      },
      {
          "id": "1-744810951",
          "name": "Foundation For Life      (Tyneside Pregnancy Advice Centre)",
          "numberOfLocations": 1
      }
  ]
  </code></pre>
  
  <p>What I'm expecting is, if 'pregnancy' is missing from the each array field, it should fail the test</p>