Windows phone 7 json .net
本文关键字:net json phone Windows | 更新日期: 2023-09-27 18:25:15
我从appengine得到以下响应:
{"status":"OK",
"results":[{
"field1":"ee2",
"field2":"ee",
"field3":0.0,
"field4":0.0,
"field5":1990,
"field6":"dd"}]
}
其中results是一个数组。
我想用Newtonsoft.Json把它解析成一个ObservableCollection。你能帮我怎么做吗?
我希望这可能会有所帮助:http://www.smallandmighty.net/blog/more-json-with-windows-phone
您可以尝试以下操作:
var jObject = JObject.Parse(data); //where data is your json response data
var token = jObject.SelectToken("result");
var children = token.Children();
foreach(var child in children)
{
// Do something with your data
string field1 = (string)child.SelectToken("field1");
}
希望它能有所帮助!干杯/安德斯
dynamic Results = new Uri(url).GetDynamicJsonObject();
foreach (var result in Results.results)
{
string str = result.field1;
//add to ObservableCollection list
}