[Solved] Retrieving json data which in C#


Create C# classes that map to your json. As below:

public class Data
{
    public List<Employee> Employees { get; set; }
}

public class Employee
{
    public List<EmpDetails> EmpDetailss { get; set; }
}

public class EmpDetails
{
    public int Empid { get; set; }
    public string Empname { get; set; }
    public string Empdept { get; set; }
    public EmpPhone EmpPhone{ get; set; }
}

public class EmpPhone
{
    public string Home { get; set; }
    public string Office { get; set; }
}

and then

WebClient c = new WebClient();
var json = c.DownloadString("sampleurl");
Data data = JsonConvert.DeserializeObject<Data>(json);

2

solved Retrieving json data which in C#