title: Creating Model Class in C#?
body: <p>So I simply have a simple web API that returns JSON format as following</p>
  
  <pre><code>{
  "dailyDealId": "432",
  "discountPercentage": "0",
  "product": {
      "productId": "10",
      "brandId": "10",
      "departmentId": "3",
      "name": "Baby Girl Velour Tunic &amp; Snowflake Legging Set",
      "description": "The pretty set",
      "url": "http://whatever.whatever.com/files/whatever.tif"
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I want to get this data on my C# console code</p>
  
  <p>this is my Model Class Data.cs</p>
  
  <pre><code>class Data
  {
      public string dailyDealId { get; set; }
      public string discountPercentage { get; set; }
      public Array product { get; set; }
  }
  </code></pre>
  
  <p>and this is my main Code</p>
  
  <pre><code>static void Main(string[] args)
      {
  
          HttpClient client = new HttpClient();
          client.BaseAddress = new Uri("http://whatever.com/");
  
          HttpResponseMessage response = client.GetAsync("product/").Result;
  
          if (response.IsSuccessStatusCode)
          {
               var products = response.Content.ReadAsAsync&lt;IEnumerable&lt;Data&gt;&gt;().Result;
  
              foreach (var p in products)
              {
  
                  Console.WriteLine("dailyDealId" + p.dailyDealId);
              }
  
  
          }
  
      }
  </code></pre>
  
  <p>But it doesnt seem to work and I get Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON Error, any help would be appreciated </p>
  
  <p>Thanks</p>