title: Mule ESB can not trigger Choice 'when' condition
body: <p>I can not get Mule ESB to trigger a Choice 'when' condition</p>
  
  <p>I converted a Hello World flow to to accept aJSON object (inserting a JSON to Object node) and execute a Choice node.  </p>
  
  <p>But I can not trigger the 'when' condition of the CHoice statement; I always goto the DEFAULT case. Below is the flow:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:json="http://www.mulesoft.org/schema/mule/json" version="EE-3.5.0" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
  http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
  http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
  http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd"&gt;
      &lt;json:object-to-json-transformer name="Object_to_JSON" doc:name="Object to JSON"/&gt;
      &lt;flow doc:name="HelloWorldFlow1" name="HelloWorldFlow1"&gt;
          &lt;http:inbound-endpoint doc:description="This endpoint receives an HTTP message." doc:name="HTTP" exchange-pattern="request-response" host="localhost" port="8081" contentType="application/json"/&gt;
          &lt;json:json-to-object-transformer doc:name="JSON to Object" /&gt;
          &lt;choice doc:name="Choice-Determine-Route" tracking:enable-default-events="true"&gt;
              &lt;when expression="#[payload.uid == &amp;quot;\042ABC\042&amp;quot;]"&gt;
                  &lt;set-payload value="#['When ABC case']" doc:name="Set Payload"/&gt;
              &lt;/when&gt;
              &lt;otherwise&gt;
                  &lt;set-payload value="#['Default case, payload:  ' + payload + ', payload.get(\047uid\047): ' + payload.get('uid')]" doc:name="Set Payload"/&gt;
              &lt;/otherwise&gt;
          &lt;/choice&gt;
      &lt;/flow&gt;
  &lt;/mule&gt;
  </code></pre>
  
  <p>In this flow I use the following conditional and SetPayload (Default case) statements:</p>
  
  <pre><code>#[payload.uid == "\042ABC\042"]
  
      ( Note:  I used the \042 (double quote) because JSONPATH expressions will return "ABC" instead of ABC )
  
  #['Default case, payload:  ' + payload + ', payload.get(\047uid\047): ' + payload.get('uid')]
  </code></pre>
  
  <p>Below is my output:</p>
  
  <pre><code>C:\curl&gt;type input2.txt
  { "uid" : "ABC" }
  
  C:\curl&gt;curl -H "Content-Type: application/json" -i -d @input2.txt http://localh
  ost:8081
  
  Default case, payload:  {"uid":"ABC"}, payload.get('uid'): "ABC"
  </code></pre>
  
  <p>As you can see I did not trigger the 'when' clause.  However, the SetPayload does output payload.get('uid') as "ABC"</p>
  
  <p>So I try again three different times, with three different 'when' conditions:</p>
  
  <pre><code>#[payload.uid == "ABC"]
  
  #[payload.get('uid') == "ABC"]
  
  #[payload.get('uid') == "\042ABC\042"]
  </code></pre>
  
  <p>But in all three of these cases, I get the following:</p>
  
  <pre><code>Default case, payload:  {"uid":"ABC"}, payload.get('uid'): "ABC"
  </code></pre>
  
  <p>How can I resolve this ?</p>
  
  <p>Thanks</p>