I have one class defined as
public class TestRun
{
[JsonProperty("links")]
public List<Links> Links { get; set; }
[JsonProperty("id")]
public string id { get; set; }
[JsonProperty("name")]
public string name { get; set; }
[JsonProperty("pid")]
public string pid { get; set; }
[JsonProperty("properties")]
public List<Properties> Properties { get; set; }
[JsonProperty("test_case")]
public TestRunCase test_case { get; set; }
[JsonProperty("test_case_version_id")]
public string test_case_version_id { get; set; }
[JsonProperty("page")]
public string page { get; set; }
[JsonProperty("page_size")]
public string page_size { get; set; }
[JsonProperty("total")]
public string total { get; set; }
[JsonProperty("items")]
public List<Items> Items { get; set; }
}
Another part of my code fetches a JSON data string and assigned the converted data to an array
TestRun[] RunData = JsonConvert.DeserializeObject<TestRun[]>(testrun_Data);
Most of time this JSON string of testrun_Data consists of an array of TestRun type of data which is fine. But when it is like what's shown below,
{"links":[],"page":1,"page_size":100,"total":0,"items":[]}
An exception of type Newtonsoft.Json.JsonSerializationException
will be thrown.