Model转Json
model是实例化后的对象
//忽略空的元素
var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
//Model转Json
string result = JsonConvert.SerializeObject(model, Newtonsoft.Json.Formatting.Indented, jsonSetting);
Json转Model
Model是类
var model = JsonConvert.DeserializeObject<Model>(requestStr.ToString());
欢迎访问作者个人技术博客:www.blackvon.top
作者的微信公众号和小程序