質問

After doing a Fb.AppRequest, in my callback, I try to parse out how many users where invited by the user doing the invitation.

The problem I'm having, is that I'm parsing my result as follows:

var responseObject = Json.Deserialize(result.Text) as Dictionary<string, object>;

and when I try to access the "to" parameter, I cant get the value as an array. I tried the following, but it didnt work either.

        object obj = 0;
        if (responseObject.TryGetValue ("to", out obj))                                                              
        {      
            Debug.Log("Sent to: " + ((string[])obj).Length);                                                                                  
        }  

Any help on how I can get the amount of users to which I sent the invite to?

Thanks a lot

役に立ちましたか?

解決

If you only need to know how many objects do you have, you can cast that object to an IEnumerable for example:

IEnumerable<object> obj = (IEnumerable<object>)responseObject["to"];
int count = obj.Count(); 

or something like that. Hope that helps !

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top