public class Root
{
public int id { get; set; }
}
Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
Source/destination JSON
{
"id": 08
}
Expected behavior
// Outputs to the console 8
Console.WriteLine(myDeserializedClass.id)
Actual behavior
Exception: Input string '08' is not a valid number. Path 'id', line 1, position 17.
Steps to reproduce
Newtonsoft.Json version 10.0.3
using Newtonsoft.Json;
void Main()
{
var myJsonResponse = "{\"id\":08}";
Root myDeserializedClass = JsonConvert.DeserializeObject<Root>(myJsonResponse);
}
public class Root
{
public int id { get; set; }
}
See also #2035 (TL;DR technicaly this is not a bug, and this library is in a very low touch maintenance phase so all bets are off in terms of the library having an in-the-box answer for your problem)
Source/destination types
Source/destination JSON
Expected behavior
Actual behavior
Exception: Input string '08' is not a valid number. Path 'id', line 1, position 17.
Steps to reproduce
Newtonsoft.Json version 10.0.3