JsonConvert. splicializeObject不会自动将字符串转换为int

2admgd59  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(75)

我正在尝试将{"fileNumber": "1"} JSON反序列化为以下对象。

CustmObj jFile = JsonConvert.DeserializeObject<CustmObj>(json)objects.

public class CustmObj
{
   [JsonProperty("fileNumber")]
   public uint FileNumber { get; set; }
}

字符串
我希望它能自动将int转换为string,但它一直抛出错误"Error converting value .. to type 'System.UInt32'. Path ..."
我该怎么做?

pod7payv

pod7payv1#

我正在尝试将{“fileNumber”:“1”} json反序列化为以下对象。
只需删除integer:{“fileNumber”:1}的“

相关问题