title: How do I modify Mule payload variables?
body: <p>Using Mule 3.3, I've got a Payload (which starts out as a JSON and I'm converting it to an Object using java.util.HashMap).  I can access the variables just fine from a JDBC query using:</p>
  
  <pre><code>#[message.payload.AddJob.variable1]
  </code></pre>
  
  <p>How do I go about adding a new variable (say variable2), or modifying the value of an existing variable?</p>
  
  <p>I've tried:</p>
  
  <pre><code>&lt;message-properties-transformer doc:name="Message Properties"&gt;
      &lt;add-message-property key="message.payload.AddJob.variable2" value="&amp;quot;hello&amp;quot;"/&gt;
  &lt;/message-properties-transformer&gt;
  </code></pre>
  
  <p>Which had no effect.</p>
  
  <p>I also tried a groovy Script (below) as suggested here: <a href="https://stackoverflow.com/questions/9155062/how-to-add-additional-data-to-a-mule-payload">How to add additional data to a mule payload?</a>, but it overwrites the entire payload with "hello", not just variable2.</p>
  
  <pre><code>payload['AddJob.variable2'] = 'hello'
  </code></pre>