title: Mule 4 - Replace a JSON value in JSON Array with Dataweave 2
body: <p>In my <strong>Mule 4</strong> flow I get a JSON Array similar to the following:</p>
  
  <pre><code> [
       {
           "type": "error",
           "status": 404,
           "code": "not_found",
           "message": "Could not find the resource",
       },
       {
           "type": "error",
           "status": 401,
           "code": "",
           "message": "Could not find the specified ",
       }
   ]
  </code></pre>
  
  <p>I want to change the value of the <code>message</code> field to a <code>vars.germanMessage</code> variable for each JSON object.</p>
  
  <p>I've tried to modify it with <strong>Dataweave 2</strong> this way:</p>
  
  <pre><code>%dw 2.0
  output application/java
   ---
  (payload as Array) map {
  
      "message": vars.germanMessage
  
  }
  </code></pre>
  
  <p>But this returns a new JSON message with only the <code>message</code> field.</p>
  
  <p>The input type is <code>Array&lt;Object&gt;</code> and output type too.</p>
  
  <p>Is there any way to replace the value without changing the rest of the message?</p>