title: Play Framework: How to bind a complex REST request to a Controller method
body: <p>Working on a REST API with Play Framework.</p>
  
  <p>I have a requirement to support a <strong>RESTful request</strong> containing the "order" with multiple "line items".</p>
  
  <p>In terms of the "POST data", I see it like: (split into multi-lines for clarity)</p>
  
  <pre><code>OrderId=123&amp;OrderType=regular&amp;
  ItemNum=1&amp;ItemID=78&amp;quantity=2&amp;discount=20&amp;
  ItemNum=2&amp;ItemID=70&amp;quantity=1&amp;
  ItemNum=3&amp;ItemID=75&amp;quantity=1&amp;discount=10
  </code></pre>
  
  <p>Note that I have an issue to require all the "line items" to come with a full set of data. In the example above, the 2nd item has no discount. Since I cannot "force" developers using the API to work with my own "wrapper", I want to leave some flexibility.</p>
  
  <p>I would like to map it to something like:</p>
  
  <p><strong>method(int orderID, string orderType, Item[] items)</strong></p>
  
  <p>However, I failed to find something appropriate in the docs.</p>
  
  <p>What's the right way?
  Should I build my own parser of the HTTP request data?
  Any alternative way to format the POST data - as long as it is ok with REST guidelines - is also acceptable.</p>
  
  <p>Thanks
  Max</p>