using Newtonsoft.Json;//引用命名空间
Dictionary<string, string> Content = new Dictionary<string, string>();
Content.Add("bulletinContent", "this is bulletinContent");
Content.Add("topToDay", "this is topToDay");
//Dictionary转json
string Contentjson = JsonConvert.SerializeObject(Content);
//json转Dictionary
Dictionary<string, string> DicContent = (Dictionary<string, string>)JsonConvert.DeserializeObject(Contentjson.ToString());
C# Dictionary类型转json方法之一
点赞
收藏