c#jsonobjectDictionary互转//object 转 string(json)
string result = JsonConvert.SerializeObject(user);
//object 转 JObject
JObject jo = (JObject)JToken.FromObject(user);
//JObject 转 string(json 带换⾏)
object to
//jo.ToString()
//object 转 Dictionary
IDictionary<string, object> list = ObjectToDictionaryHelper.ToDictionary(user);
//string(json) 转 Dictionary
Dictionary<string, Object> list2 = JsonConvert.DeserializeObject<Dictionary<string, Object>>(result);
//string(json) 转 object
User user3 = JsonConvert.DeserializeObject<User>(result);

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。