Deserialize Facebook friends result

I’m trying to deserialize the result that returned from FB request.

I’ve managed to get the users list who are already logged in to my app through facebook by using this line:

FB.API ("/me/friends", Facebook.HttpMethod.GET, FBFriendsCallback);

After a quick debugging I can see that the recieved data is fine including the usernames, IDs etc…

The only issue that holding me is that I can’t figure out how to deserialize the FBResult.

Here’s what I’ve tried (the DeserializeJSONFriends function is taken from one of Facebook examples):

    public static List<object> DeserializeJSONFriends(string response)
		Dictionary<string, object> responseObject = Json.Deserialize(response) as Dictionary<string, object>;
		object friendsH;
		List<object> friends = new List<object>();
		if (responseObject.TryGetValue("invitable_friends", out friendsH))
			friends = (List<object>)(((Dictionary<string, object>)friendsH)["data"]);
		if (responseObject.TryGetValue("friends", out friendsH))
			friends.AddRange((List<object>)(((Dictionary<string, object>)friendsH)["data"]));
		return friends;

I keep getting 0 count from the friends object although the original result that sent to this function is totally fine including all the users details.

*none of the "if"s is true at runtime so none of this objects getting values.

I’ve finally managed to get the values with alot of help from this question.

I’m adding my code, hopefully it’ll help someone at the future.

public void FriendsHighscoreHndlr (string FBresult){			
	var dict = Json.Deserialize(FBresult) as Dictionary<string,object>;
	var friendList = new List<object>();
	friendList = (List<object>)(dict["data"]);
	int _friendCount = friendList.Count;
	Debug.Log("Found friends on FB, _friendCount ... " +_friendCount);

	List<string> friendIDsFromFB = new List<string>();
	for (int i=0; i<_friendCount; i++) {
		string friendFBID = getDataValueForKey( (Dictionary<string,object>)(friendList*), "id");*

_ string friendName = getDataValueForKey( (Dictionary<string,object>)(friendList*), “name”);_
Debug.Log( i +“/” +friendCount +" " +friendFBID +" " +friendName);

* }*
* }*
* private string getDataValueForKey(Dictionary<string, object> dict, string key) {*
* object objectForKey;*
* if (dict.TryGetValue(key, out objectForKey)) {*
* return (string)objectForKey;*
* } else {*
* return “”;*
* }*
* }*
I have to mention that some extra documentation about deserialization from Facebook and Unity side will be definitely helpful.