C#配json字典并调用

1.添加引用

Newtonsoft.dll

2.引用

using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

3.配json字典

public string ReturnDic()
{
string Arr = "{" +
"\"aa\":\"11\"" +
",\"bb\":\"22\"" +
",\"cc\":\"33\"" +
",\"dd\":\"44\"" +
"}";

return Arr;
}

4.调用

string dic = Dic.ReturnDic();
JObject jo = (JObject)JsonConvert.DeserializeObject(dic);

jo.Property(“aa”);

posted @ 2019-03-02 15:41  五点  阅读(917)  评论(0编辑  收藏  举报