title: get correct json output from c# class
body: <p>Please check from Json output i wanted using JavaScriptSerializer. Then check class helper i created using json2csharp.com. Problem is in controller. I am not getting correct output as per my required Jason. I am doing correct in controller? Where the problem can be? Please ask question if you want to know something specific, sorry its hard to describe more clearly.</p>
  
  <p>Helper Class Code:</p>
  
  <pre><code>public class ItemsFromFile
      {
          public string ASIN { get; set; }
          public string Title { get; set; }
          public List&lt;Product&gt; products { get; set; }
  
      }
  
      public class ItemsDeatails
      {
          public List&lt;ItemsFromFile&gt; ItemsFromFile { get; set; }
      }
  
      public class File
      {
          public string nameLocator { get; set; }
          public ItemsDeatails itemsDeatails { get; set; }
      }
  
      public class RootObject
      {
          public string Token { get; set; }
          public File file { get; set; }
      }
  </code></pre>
  
  <p>Controller code:</p>
  
  <pre><code>if (type == "Salefreaks")
                  {
              var token = ctx.BulkStores.FirstOrDefault(x =&gt; x.StoreName == store &amp;&amp; x.Type == 1).Token;
  
              var ItemsFromFile = new ItemsFromFile()
                      {
                          products = new List&lt;Product&gt;()
                      };
  
                      var ItemsDeatails = new ItemsDeatails()
                      {
  
                      };
  
                      var File = new File()
                      {
                          nameLocator = "testimport1"
                      };
  
                      var RootObject = new RootObject()
                      {
                          Token = token
                      };
  
              var singleItems = ctx.BulkScannedItems.Where(x =&gt; x.UserSellerScanRequestId == id).ToList();
  
                      foreach (var item in singleItems)
                      {
                          ItemsFromFile.products.Add(new Product { ASIN = item.ASIN, Title = item.EbayTitle });
                      }
  
                      var json = new JavaScriptSerializer().Serialize(RootObject);
           }
  </code></pre>
  
  <p>Required Json Output code:</p>
  
  <pre><code>{
    "Token": "7f3099b0-36b1",
    "file": {
      "nameLocator": "testimport1",
       "itemsDeatails": {
        "ItemsFromFile": [
        {
           "ASIN": "B011KVFT9Y",
           "Title": "Disney Batman Durable Party Beach Outdoor Adventure Camp Chair w/ Storage Bag"
         },
         {
           "ASIN": "B01D4KRBW2",
           "Title": "High Quality Diy Oil Painting Paint Number Kit Theme-Romantic Street A Frameless"
         }
        ]
      }
    }
  }
  </code></pre>