title: How can I restore the int deserialization behavior after upgrading Json.NET?
body: <p>I have some <code>.NET</code> code that deserializes <code>JSON</code> objects created by a <code>webservice</code> running a dynamic language. Because the source is dynamic, it sometimes serializes integral values in float format (e. g. 2 gets serialized to "2.0").</p>
  
  <p>With <code>Json.NET 4.0.4</code>, this worked seamlessly (seems like rounding was applied when deserializing). With the upgrade to <code>Json.NET 4.5</code>, though, deserializing 2.0 now throws a <code>FormatException</code>. Here's the code:</p>
  
  <pre><code>// works as expected in both versions
  var s = "2";
  Console.WriteLine(JsonConvert.DeserializeObject&lt;int&gt;(s));
  
  // throws FormatException in 4.5 only
  var s = "2.0";
  Console.WriteLine(JsonConvert.DeserializeObject&lt;int&gt;(s));
  
  // throws FormatException in 4.5, rounds to 3 in 4.0.4
  var s = "2.6";
  Console.WriteLine(JsonConvert.DeserializeObject&lt;int&gt;(s));
  </code></pre>
  
  <p>Is there any easy way to restore the original behavior? The ideal behavior would be to deserialize only numbers with integral values, but in any format (e. g. 2.0, 1e10, but not 2.5), but I'd settle for the 4.0.4 behavior.</p>