这是我使用的反序列化JSON.But当我尝试在控制台写它的代码,它说:“System.Collections.Generic.Dictionary`2 [System.String,System.Object的]”如何反序列化Json对象?
System.Net.WebClient wc = new System.Net.WebClient();
string Jayson = wc.DownloadString("http://api.urbandictionary.com/v0/define?term=api");
object obj = JsonHelper.Deserialize(Jayson);
Dictionary<string, object> values =
JsonConvert.DeserializeObject<Dictionary<string, object>>(Jayson);
Console.WriteLine(values);
我如何反序列化它并从JSON中只提取“定义”?
你能提供“杰森”的样本价值? –
如果你打开http://api.urbandictionary.com/v0/define?term=api,你可以看到所有的JSON。我想提取“:[{”definition“: –
这不是一个关于试图写一个字典的问题吗?像values.ToList().ForEach(x => Console.WriteLine(x.Key)); – Mulflar