用C#反序列化JSON我试图将Facebook好友图API调用反序列化为对象列表。JSON对象如下所示:{"data":[{"id":"518523721","name":"ftyft"},
{"id":"527032438","name":"ftyftyf"},
{"id":"527572047","name":"ftgft"},
{"id":"531141884","name":"ftftft"},
{"id":"532652067","name"... List<EFacebook> facebooks = new JavaScriptSerializer().Deserialize<List<EFacebook>>(result);因为原始对象无效,所以它无法工作。我如何将其反序列化?
6 回答
宝慕林4294392
TA贡献2021条经验 获得超8个赞
Newtonsoft.JSON
Newtonsof.JSON
JavaScriptSerializer
, DataContractJsonSerializer
.
var jsonData = JObject.Parse("your json data here");
JArray
for (int i = 0; (JArray)jsonData["data"].Count; i++){ var data = jsonData[i - 1];}
- 6 回答
- 0 关注
- 1105 浏览
添加回答
举报
0/150
提交
取消