Transfer from http://blog.sina.com.cn/s/blog_84ee61a901018erd.html
Using Microsoft's own System.Web.Extensions.dll
The DLL file typically exists in the following path: C:\Program files\reference Assemblies\microsoft\framework\v3.5\system.web.extensions.dll
Converts the list collection to a JSON string, javascriptserializer serializer = new JavaScriptSerializer (); list<person> list = new list<person> (); for (int i = 0; i < i++) {person p = new person ("Zhang San" + I, "Chongqing "+ I," ten "+ i); List. ADD (P);} MessageBox.Show (serializer. Serialize (list);//Convert the JSON string to a collection, the person defines itself as the entity class string JSON = "[{' Address ': ' Chongqing 0 ', ' age ': ' + ', ' Name ': ' 30 '},{' Address ': ' Chongqing 1 ', ' age ': ' 101 ', ' Name ': ' 31 '}] "; JavaScriptSerializer serializer = new JavaScriptSerializer (); list<person> list = serializer. Deserialize<list<person>> (JSON);
2. Mvc program, you can directly use JSON (SSSSS)
C # Several ways to convert collections and JSON formats to each other