C# Json 剖析
下載json套件
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
string originalJson =@ "{\"aaa\":\"111\",\"bbb\":\"222\"}";
JObject jObject = JObject.Parse(originalJson);
Dictionary<string, object> values = JsonConvert.DeserializeObject<Dictionary<string, object>>(jObject.ToString());
foreach (var value in values)
{
string k = value.Key;
string v = value.Value.ToString();
if (v.IndexOf("[") != -1)
{
v = v.Substring(1, v.Length - 3);
jObject = JObject.Parse(v);
}
}
0 個意見:
張貼留言
訂閱 張貼留言 [Atom]
<< 首頁