I'm trying to de-serialize the {"fileNumber": "1"} JSON into the following object.
CustmObj jFile = JsonConvert.DeserializeObject<CustmObj>(json)objects.
public class CustmObj
{
[JsonProperty("fileNumber")]
public uint FileNumber { get; set; }
}
I'm expecting it to automatically convert the int to string, however it keeps throwing the error "Error converting value .. to type 'System.UInt32'. Path ..."
How can I do this?
"1"when the declared C# type is numeric. If you don't like that you can add a custom converter foruintlike the one forintfrom JSON Deserialization - String Is Automatically Converted To Int. Does that question also answer yours?"1"to anintbut will not do so for auint? And you are asking how to get the same behavior foruint? ... No, I can't reproduce that,intanduintbehave identically. See dotnetfiddle.net/0cKL9F