Hello,
I’m trying to handle a JSON response from a facebook plugin. here is the reponse:
{
"data": [
{
"user": {
"name": "Test Name",
"id": "123456789"
},
"score": 20920,
"application": {
"name": "Test Game",
"namespace": "TestGame",
"id": "123456678899087"
}
},
{
"user": {
"name": "Test Name",
"id": "123456789"
},
"score": 17340,
"application": {
"name": "Test Game",
"namespace": "TestGame",
"id": "123456678899087"
}
}
]
}
I was able to handle similar facebook response (me/friends) with this code:
try {
JsonData friends = JsonMapper.ToObject(FacebookUnityPlugin.response);
Debug.Log(friends["data"][0]["id"]);
friendlist = "";
for (int i = 0; i < 5; i++) {//First 5 friends
friendlist = friendlist + System.Environment.NewLine + friends["data"]*["name"];*
-
}*
-
} catch (System.Exception ex){*
-
Debug.Log(ex.Message);*
-
}*
But in this case this code doesn’t work because I have nested data …
Any help please ?