I need the usernames and their points from the response.
This is what the body looks like:
{
"_total": 3,
"users": [
{
"username": "person1",
"points": 3
},
{
"username": "person2",
"points": 2
},
{
"username": "person3",
"points": 1
}
]
}
My Code:
List<string> data;
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
data = JsonConvert.DeserializeObject<List<string>>(body);
foreach (var i in data) {
Debug.Log(i);
}
}
I would like to save the body to the List data and get the usernames and their points from there.