Friday, 16 May 2014

json

  public class address
    {
        public string address1, address2,city,state,country;
        public int pin;
   
    }

    public class person

    {
        public string firstname, lastname, department;

        public address adr = new address();


        public string[] technologies;

    }



 public void serialize_json()

    {
 
        person p1 = new person();
        p1.firstname = "Sapna";
        p1.lastname = "Giyanwani";
        p1.department = "Asp.net";
        p1.adr.address1 = "Saijpur Bogha";
        p1.adr.address2 = "Naroda Road";
        p1.adr.city = "Ahmedabad";
        p1.adr.state = "Gujarat";
        p1.adr.country = "India";
        p1.adr.pin=382345;
        p1.technologies = new string[] {"C","C++" ,"ASp.net" };

        str = js.Serialize(p1);

     

    }


    public void deserialize_json()

    {
        person p2 = js.Deserialize<person>(str);

        Response.Write(p2.firstname);

    }

SQL server tricky questions