title: Working with arrays within objects in expressions
body: <p>Good morning!  I'm trying to create a Web API using Mule that will transform one JSON-based request from system A into another JSON-based format, invoke a Web API on system B using the transformed JSON, take the JSON response from system B and transform it to some JSON that system A can understand, and return that result in the response to the original HTTP request.  I have it mostly working, but I can't figure out how to reference arrays within properties.  Here's the JSON going into the <code>Expression</code> component:</p>
  
  <pre><code>{
      "FooObjects":
      [
          {
              "FooPropertyOne": "value for property one"
            , "FooPropertyTwo": "value for property two"
            , "FooPropertyThree": "value for property three"
            , "FooId": 22031
            , "FooBarRelationships":
              [
                  {
                      "FooBarRelationshipId": 18014
                    , "RelationshipProperty": "value for rel property"
                    , "Bar": { "BarPropertyOne": "value for property one", "BarId": 11379 }
                  }
                , {
                      "FooBarRelationshipId": 18015
                    , "RelationshipProperty": "value for rel property"
                    , "Bar": { "BarPropertyOne": "value for property one", "BarId": 10001 }
                  }
              ]
          }
      ]
  }
  </code></pre>
  
  <p>Here's the result I want:</p>
  
  <pre><code>{
      "FooObjects":
      [
          {
              "FooPropertyOne": "value for property one"
            , "FooPropertyTwo": "value for property two"
            , "FooPropertyThree": "value for property three"
            , "FooId": 22031
            , "FooUrl": "https://server/path/to/foo?FooId=22013"
            , "Bars":
              [
                  { "BarPropertyOne": "value for property one", "BarId": 11379 }
                , { "BarPropertyOne": "value for property one", "BarId": 10001 }
              ]
          }
      ]
  }
  </code></pre>
  
  <p>Here's the expression component:</p>
  
  <pre><code>    &lt;expression-component doc:name="Expression"&gt;&lt;![CDATA[payload =
  [
      "FooObjects": ([
          "FooPropertyOne": $.FooPropertyOne
        , "FooPropertyTwo": $.FooPropertyTwo
        , "FooPropertyThree": $.FooPropertyThree
        , "FooId": $.FooId
        , "FooURl": "https://server/path/to/foo?FooId=" + $.FooId
        , "Bars": $.FooBarRelationships
      ] in payload.FooObjects)
  ];]]&gt;&lt;/expression-component&gt;
  </code></pre>
  
  <p>I've been guessing at the syntax to put in place of <code>$.FooBarRelationships</code>.  The best I can come up with is <code>(['BarPropertyOne':$.Bar.BarPropertyOne]in $.FooBarRelationships)</code>.  This gets me:</p>
  
  <pre><code>[Error: could not access: Bar; in class: java.util.LinkedHashMap]
  [Near : {... $.Bar.BarPropertyOne....}]
               ^
  </code></pre>
  
  <p>How can I perform this transformation?  If I leave out the part about <code>Bars</code>, everything works fine, apart from not getting all of the data I need.  Thanks!</p>
  
  <p><strong>edit:</strong> I changed the example to show the multiplicity more clearly.</p>