public class information
{
public string name { get; set; }
public string surname { get; set; }
}
public class JsonFormat
{
public IList<information> information { get; set; }
}
protected void gettextbox_Click(object sender, EventArgs e)
{
JsonFormat newjson = new JsonFormat();
List<information> p = new List<information>();
information add1 = new information { name = textbox1.Text , surname = textbox2.Text };
information add2 = new information { name = textbox3.Text, surname = textbox4.Text };
p.Add(add1);
p.Add(add2);
newjson.information = p;
string json = JsonConvert.SerializeObject(newjson);
}
string json here :
"{\"information\":[{\"name\":\"data1\",\"surname\":\"data2\"}, \"name\":\"data3\",\"surname\":\"data4\"}]}"
it's okay here but, how can I deserialize the data on the list? Thank you in advance for your help.