You need to create a structure like this:
public class Friends { public List<FacebookFriend> data {get; set;} } public class FacebookFriend { public string id {get; set;} public string name {get; set;} }
Then you should be able to do:
Friends facebookFriends = new JavaScriptSerializer().Deserialize<Friends>(result);
The names of my classes are just an example. You should use proper names.
Adding a sample test:
string json = @"{""data"":[{""id"":""518523721"",""name"":""ftyft""}, {""id"":""527032438"",""name"":""ftyftyf""}, {""id"":""527572047"",""name"":""ftgft""}, {""id"":""531141884"",""name"":""ftftft""}]}"; Friends facebookFriends = new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<Friends>(json); foreach(var item in facebookFriends.data) { Console.WriteLine("id: {0}, name: {1}", item.id, item.name); }
Produces:
id: 518523721, name: ftyft id: 527032438, name: ftyftyf id: 527572047, name: ftgft id: 531141884, name: ftftft