title: How to filter an array of JSON in Mule DataWeave
body: <p>I am having a JSON like this :</p>
  
  <pre><code>{
    "dcsId": "1184001100000000517",
    "marketCode": "US",
    "languageCode": "en-US",
    "profile": {
    "base": {
       "username": "arunima27",
       "activeInd": "R",
       "phone": [
         {
            "activeInd": "Y",
            "type": "mobile",
            "primaryInd": "Y",
            "number": "2234566788"
         },
         {
           "activeInd": "N",
           "type": "mobile",
           "primaryInd": "N",
           "number": ""
         }
        ]
      }
    }
   }
  </code></pre>
  
  <p>From this input JSON we need to extract the payload.profile.base.phone.number where the payload.profile.base.phone.type == "mobile" and payload.profile.base.phone.activeInd == "Y". Actually we need to loop through the JSON array (payload.profile.base.*phone) and get only the phone numbers which are active and having the category / type as mobile.</p>
  
  <p>We need the output like below :</p>
  
  <pre><code>{
    "dcsId": "1184001100000000517",
    "marketCode": "US",
    "languageCode": "en-US",
    "username" :  "arunima27", 
    "phoneNumber" : "2234566788"
  }  
  </code></pre>
  
  <p>We are facing problem in doing this transformation for the "phoneNumber" output variable. </p>