I have a simple serialized json array
string json = "[{\"id\":100,\"UserId\":99},{\"id\":101,\"UserId\":98}]";
var data = (List<Model>)Newtonsoft.Json.JsonConvert.DeserializeObject(json , typeof(List<Model>));
my model to deserialize:
public class Model
{
public int? id { get; set; }
public int? UserId { get; set; }
}
What is the best way to retrieve data from each Index[?] and print it to Console ?
data[n]anddata.Count, exactly? Also you can get rid of the cast by usingvar data = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model>>(json);instead.