在类的字段上使用JsonProperty特性来指定其对应的JSON属性名称,或者将字段改为属性。
示例代码如下:
// 以字段为例 public class MyClass { [JsonProperty("myProperty")] public int MyField; } // 以属性为例 public class MyClass { public int MyProperty { get; set; } }
上一篇:ASP.NETCore中,因为SelectList导致ModelState.IsValid一直为false
下一篇:ASP.NetCore注入SSH客户端