Unity Json解析

2017-07-02  本文已影响0人  卓灬不凡

.NET 库: Newtonsoft.Json

下载地址:http://www.newtonsoft.com/json

引入:using Newtonsoft.Json;

Json 转 Dictionary:

string json = "{'test','123'}";

Dictionary<string, object> dic= JsonConvert.DeserializeObject<Dictionary<string, object>>(json);

Dictionary 转 Json:

Dictionary<string, object> dic = new Dictionary<string, object>();

dic.Add("test","123");

string json = JsonConvert.SerializeObject(dic);

上一篇下一篇

猜你喜欢

热点阅读