title: Creating a json-style inside a linq select statement
body: <p>In my MVC controller, I have the following linq query (which works fine):</p>
  
  <pre><code>var result = from li in lineItems
               join r in rates on li.something = r.something
               select new
               {
                   li.something
                   li.somethingElse
                   li.another
                   r.something
                   r.somethingElse
                   r.rate1
                   r.rate2
                   r.rate3
                   r.rate4
               };
  
  return JSON(result.ToList(), JsonRequestBehavior.AllowGet);
  </code></pre>
  
  <p>And that generates a flat object just fine. However, what I really need is for the rates to be an object of their own, one layer deeper, like this:</p>
  
  <pre><code>{
      li.something
      li.somethingElse
      li.another
      r.something
      r.somethingElse
      rates = {
                  {id = "1", value = r.rate1}
                  {id = "2", value = r.rate2}
                  {id = "3", value = r.rate3}
                  {id = "4", value = r.rate4}
              }
  }
  </code></pre>
  
  <p>I'm having difficulty getting the C# syntax right to make that happen. Hardcoding the id is fine. I will always only have rate 1 2 3 and 4.</p>