title: Unable to deserialize the JSON result in C#. Input string is not in a correct format error
body: <p>I am trying to deserialize a json output to a C# object.
  JSON result: </p>
  
  <pre><code>{"order":{"commission":3.490000,"cost":4.490000,"duration":"day","extended_hours
  ":false,"fees":0.000000,"class":"equity","price":1.000000,"quantity":1.000000,"r
  equest_date":"2013-11-26T09:43:17.118Z","result":true,"side":"buy","status":"ok"
  ,"symbol":"DIS","type":"limit"}}
  </code></pre>
  
  <p>My derived class from JSON:</p>
  
  <pre><code>    public class Rootobject
  {
      public Order Order { get; set; }
  }
  
  public class Order
  {
      public float commission { get; set; }
      public float cost { get; set; }
      public string duration { get; set; }
      public bool extended_hours { get; set; }
      public int fees { get; set; }
      public string _class { get; set; }
      public int price { get; set; }
      public int quantity { get; set; }
      public DateTime request_date { get; set; }
      public bool result { get; set; }
      public string side { get; set; }
      public string status { get; set; }
      public string symbol { get; set; }
      public string type { get; set; }
  }
  </code></pre>
  
  <p>Code used to deserialize (JSON.NET from Newtonsoft) :</p>
  
  <pre><code> Rootobject ord = JsonConvert.DeserializeObject&lt;Rootobject&gt;(responsebody);
  </code></pre>
  
  <p>I am getting the following error.</p>
  
  <pre><code> Unhandled Exception: System.FormatException: Input string was not in a correct format.
     at Newtonsoft.Json.Utilities.ConvertUtils.Int32Parse(Char[] chars, Int32 start, Int32 length)
     at Newtonsoft.Json.JsonTextReader.ParseNumber()
     at Newtonsoft.Json.JsonTextReader.ParseValue()
     at Newtonsoft.Json.JsonTextReader.ReadInternal()
     at Newtonsoft.Json.JsonReader.ReadAsInt32Internal()
     at Newtonsoft.Json.JsonTextReader.ReadAsInt32()
     at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(Jso
  nReader reader, JsonContract contract, Boolean hasConverter)
  </code></pre>
  
  <p>I have tried saving the deserialized result to a "dynamic" object which works fine. But I do not want to use the dynamic object for mapping the fields.</p>
  
  <p>Please advice.</p>
  
  <p>Note: Also the 3rd party API is sending a field called "class". How do I call this as I get compile-time error when I try to directly call the field.</p>