title: Mule Dataweave Replace Null with Specific Value
body: <p>My request payload looks something like below:</p>
  
  <pre><code>{
      "AllCodes": [
          {
              "Code1": "ABC"
          },
          {
              "Code2": "TUV"
          },
          {
              "Code3": "XYZ"
          }
      ]
  }
  </code></pre>
  
  <p>I have a function which will replace the values in the above with a certain value. The code that I've now is below:</p>
  
  <pre><code>%dw 1.0
  %output application/json
  %function LookUp(codes) codes mapObject {($$): $.code} //function to return string values for above codes
  %var codeLookup = LookUp(sessionVars.OutputCodes)
  %var FinalCodes = payload.AllCodes map codeLookup[$] joinBy ';' 
  --
  FinalCodes
  </code></pre>
  
  <p>The output of sessionVars.OutputCodes is:</p>
  
  <pre><code>{
    "CodeMaster": {
      "PrimaryCodes": {
        "PrimarySpecCodes": {
          "ABC": {
            "code": "ABC-String1"
          },
          "TUV": {
            "code": "TUV-String2"
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>The output that I am expecting is: </p>
  
  <pre><code>"ABC-String1;XYZ-String2;XYZ"
  </code></pre>
  
  <p>As you can see above, since the function is returning the values for only "ABC" and "TUV" codes, my final output should have the original value if no function value found.</p>
  
  <p>I was trying to use a default value before map operator. But it doesn't seem to work.</p>