title: How to create nested JSON response with Entity Framework Query
body: <p>I want to get a nested JSON reply with my EF query and not sure how to do this.
  I have declared my Models as follows:</p>
  
  <pre><code>  [Serializable]
      public class StockReturnMethod
      {
          public int WarehouseID { get; set; }
          public int ProductSKUID { get; set; }
          public int LotID { get; set; }
          public string LotName { get; set; }
          public int AreaID { get; set; }
          public string AreaName { get; set; }
          public int BinID { get; set; }
          public string BinName { get; set; }
          public List&lt;AvailibleStock&gt; Stock { get; set; }
      }
  
  
    [Serializable]
      public class AvailibleStock
      {
          public int WarehouseID { get; set; }
          public int ProductSKUID { get; set; }
          public string ProductSKUName { get; set; }
          public string WarehouseName { get; set; }
          public string Status { get; set; }
          public int QtyUnassigned { get; set; }
      }
  </code></pre>
  
  <p>Here is my EF query that I have so far.</p>
  
  <pre><code>    {
         return (from WH in SCMENT.Warehouses 
                 join WL in SCMENT.WarehouseLots on WH.WarehouseID equals WL.WarehouseID
                 join WA in SCMENT.WarehouseAreas on WL.WarehouseLotID equals WA.WarehouseLotID
                 join WB in SCMENT.WarehouseBins on WA.WarehouseAreaID equals WB.WarehouseAreaID
                 join SLI in SCMENT.StockLineItems on WH.WarehouseID equals SLI.WarehouseID
                 join PSKU in SCMENT.ProductSKUs on SLI.ProductSKUID equals PSKU.ProductSKUID
                 where SLI.SystemAreaID == 1
  
                 select new StockReturnMethod() 
                 {
                  WarehouseID = WH.WarehouseID,
                  LotID = WL.WarehouseLotID,
                  LotName = WL.WarehouseLotName,
                  AreaID = WA.WarehouseAreaID,
                  AreaName = WA.WarehouseAreaName,
                  BinID = WB.WarehouseBinID,
                  BinName = WB.WarehouseBinName,
                  ProductSKUID = PSKU.ProductSKUID,
                  Stock = (Will I create a sub query here?)
  
  
                 }
  
      )
  </code></pre>