class Customer
{
public int Id { get; set; }
public string Name { get; set; }
public int Salary { get; set; }
public Address Address { get; set; }
}
class Address
{
public string City { get; set; }
public int PinCode { get; set; }
}
class Program
{
static void Main(string[] args)
{
Customer c = new Customer();
c.Id = 1;
c.Salary = 1111;
c.Name = "Amit Patel";
c.Address = new Address();
c.Address.City = "Pune";
c.Address.PinCode = 411078;
var customer = Newtonsoft.Json.JsonConvert.SerializeObject(c);
Console.WriteLine(customer);
Customer c1 = Newtonsoft.Json.JsonConvert.DeserializeObject<Customer>(customer);
Console.Read();
}
}