I would parse JSON string received to my ReturnClass (collection of ReturnClass).
My JSON string :
[
{ "EmpId": 1, "Name": "Simone", "City": "Italy" },
{ "EmpId": 2, "Name": "Luca", "City": "Francia" },
{ "EmpId": 1, "Name": "Matteo", "City": "Inghilterra"},
{ "EmpId": 2, "Name": "Marco", "City": "Spagna" }
]
My ReturnClass :
public class ReturnClass
{
public int EmpId { get; set; }
public string Name { get; set; }
public string City { get; set; }
}
This is my code tath doesn't works.. Error of Parsing
HttpResponseMessage response = client.GetAsync(URL).Result; // Blocking call!
if (response.IsSuccessStatusCode)
{
string output = JsonConvert.SerializeObject(response.Content.ReadAsStringAsync().Result);
JsonConvert.DeserializeObject<ReturnClass>(output);
}