Closed DamaSistem closed 2 years ago
Hello, I am trying to convert the object from the server into a list element, but I have not been successful. Here is my code. ` socket.OnUnityThread("friendsStatus", (data) => { //var friends = JsonConvert.DeserializeObject
(data.GetValue().GetRawText(), new JsonSerializerSettings //{ // TypeNameHandling = TypeNameHandling.Auto //});
Debug.Log(data.GetValue()); // Output of the log : [{"indexnumber":2,"status":0},{"indexnumber":3,"status":0}] });`
How to reach like friends[0].status. Thanks a lot.
I figure out :D My bad. This is how i should have done when deserializing data.GetValue().ToString().
Hi,
you can get the first object(with the index 0) within the list like this:
data.GetValue<FriendStatus>(0);
see: https://github.com/doghappy/socket.io-client-csharp#quick-start
have a good day;
Hello, I am trying to convert the object from the server into a list element, but I have not been successful. Here is my code. ` socket.OnUnityThread("friendsStatus", (data) => { //var friends = JsonConvert.DeserializeObject<List>(data.GetValue().GetRawText(), new JsonSerializerSettings
//{
// TypeNameHandling = TypeNameHandling.Auto
//});
How to reach like friends[0].status. Thanks a lot.