I am working with Unity and Socket.IO and a NodeJS server when a player joins i need to send him the info abbout the other players to add them to his game. The server sends this json string:
{
"players":{
"/#3vd98L1t96vgMwRsAAAB":{
"name":"Player #2",
"x":0,
"y":0
},
"/#RaLyZw7Rnp94nDXkAAAF":{
"name":"Player #6",
"x":0,
"y":0
}
}
}
But i can't find out how to forloop this in unity? I thought making a object out of it would work so this is what i came up with:
JSONObject players = new JSONObject(e.data.GetField("players").ToString());
But how can i make a foreach loop out of it?