用C#反序列化JSON我試圖將Facebook好友圖API調(diào)用反序列化為對(duì)象列表。JSON對(duì)象如下所示:{"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);因?yàn)樵紝?duì)象無(wú)效,所以它無(wú)法工作。我如何將其反序列化?
6 回答

寶慕林4294392
TA貢獻(xiàn)2021條經(jīng)驗(yàn) 獲得超8個(gè)贊
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 關(guān)注
- 1156 瀏覽
添加回答
舉報(bào)
0/150
提交
取消