Using system;using system.collections.generic;using system.web.script.serialization;using System.Configuration; Using system.runtime.serialization.json;using system.runtime.serialization;using system.io;using System.Text; namespace webapplication1{//method One: Introduce a System.Web.Script.Serialization namespace using the JavaScriptSerializer class for simple serialization [ Serializable] public class Person {private int id; <summary>///ID//</summary> public int ID {get {return id;} set {id = value;} } private string name; <summary>///////</summary> public string name {get {return Name;} set {name = value;} }}//Method two: Introduce System.Runtime.Serialization.Json namespaces using the DataContractJsonSerializer class to implement serialization//use of Ignoredatamember: Specifies that the member is not part of a data contract and is not serialized, DataMember: Defining a serialization attribute parameter, using the DataMember property tag field must use the DataContract tag class otherwise the DataMember tag does not work. [DataContract] public class Person1 {[ignoredatamember] public int Id {get; set; } [DataMember (name = "name")] public string Name {get; set;} [DataMember (Name = "sex")] public string sex {get; set;} } public partial class _default:system.web.ui.page {string constr = configurationmanager.connectionstrings["Conns TR "]. ConnectionString; protected void Page_Load (object sender, EventArgs e) {person P1 = new person (); P1. Id = 1; P1. Name = "Dxw"; person P2 = new person (); P2. Id = 2; P2. Name = "WN"; list<person> Listperson = new list<person> (); Listperson. Add (p1); Listperson. ADD (p2); JavaScriptSerializer js = new JavaScriptSerializer (); JSON serialization of string s = js. Serialize (Listperson); Response.Write (s); Method two Person1 P11 = new Person1 (); P11. Id = 1; P11. Name = "Hello"; P11. Sex = "male"; DataContractJsonSerializer json = new DataContractJsonSerializer (P11. GetType ()); String Szjson = ""; Serialization using (MemoRystream stream = new MemoryStream ()) {json. WriteObject (stream, p11); Szjson = Encoding.UTF8.GetString (stream. ToArray ()); Response.Write (Szjson); }//Deserialization//using (MemoryStream ms = new MemoryStream (Encoding.UTF8.GetBytes (Szjson)))//{//Data Contractjsonserializer serializer = new DataContractJsonSerializer (typeof (People)); Person1 _people = (Person1) serializer. ReadObject (MS); }} protected void button1_click (object sender, EventArgs e) {Response.Write (CONSTR); } }