在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
public class UserInfo { [JsonProperty("id")] public int Id{ set; get; } [JsonProperty("userName")] public string UserName{ set; get; } }
二、使用newtonsoft.json来设置格式化的方式(推荐使用)
var user = new { Name = "john", Age = 19 }; var serializerSettings = new JsonSerializerSettings { // 设置为驼峰命名 ContractResolver = new CamelCasePropertyNamesContractResolver() }; var userStr = JsonConvert.SerializeObject(user, Formatting.None, serializerSettings);
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论