The JSON string contains a whitespace in the Resource Objects so 'id' is filled, but 'use id' 'userstatus' 'last event' are null.
I tried 3 different ways in my class but none of them works()
- Underscore
- With whitespace
- Without whitespace
My code(c#):
this is the JSON string
{
"resultsList":[
{
"id":"1",
"last event":"Mar 20 07:08 AM",
"use id":"142AD",
"user status":"offline"
},
{
"id":"2",
"last event":"Mar 19 08:07 AM",
"use id":"1426BD",
"user status":"offline"
}
]
}
I Deserialize the JSON in Results.cs(form)
string url = "API url";
var json = new WebClient().DownloadString(url);
var results = JsonConvert.DeserializeObject<Rootobject>(json);
Sessions.cs(class)
public class Rootobject
{
public Resultslist[] resultsList { get; set; }
}
public class Resultslist
{
public int id { get; set; }
public string last event { get; set; }
public string use_id { get; set; }
public string userstatus { get; set; }
}