how can i get the "Points" value using JsonConvert.DeserializeObject can anyone help me
{ "data": { "Gamers": [ { "id": "5397742571", "startTime": "Thu, 28 Jun 2022 00:04:13 GMT", "points": 11.647601, "hash": { "id": "xxxxxxxxxxxx", "hash": "xxxxxxxxxx", "__typename": "GamerRace" }, } ] }
First of all. Your json have some issue. I fix it and here is it.
{
"data": {
"Gamers": [
{
"id": "5397742571",
"startTime": "Thu, 28 Jun 2022 00:04:13 GMT",
"points": 11.647601,
"hash": {
"id": "xxxxxxxxxxxx",
"hash": "xxxxxxxxxx",
"__typename": "GamerRace"
}
}
]
}
}
Now Create Model for this json like below.
public class Data
{
public List<Gamer> Gamers { get; set; }
}
public class Gamer
{
public string id { get; set; }
public string startTime { get; set; }
public double points { get; set; }
public Hash hash { get; set; }
}
public class Hash
{
public string id { get; set; }
public string hash { get; set; }
public string __typename { get; set; }
}
Now its time to convert your json into c# object.
Data people = JsonConvert.DeserializeObject<Data>(yourJson);
Hope it helps you buddy.