JSON code: [{& quot; cId & quot;: 2, & quot; cName & quot;: & quot; \ u767d \ u841d \ u535c & quot;, & quot; amount & quot;: 26, & quot; price & quot;: & quot; 17 & quot ;},{ & quot; cId & quot;: 3, & quot; cNa
JSON code:
[{"CId": 2, "cName": "\ u767d \ u841d \ u535c", "amount": 26, "price": "17 "}, {"cId": 3, "cName": "\ u80e1 \ u841d \ u535c", "amount": 21, "price": "21" },{ "cId ": 4, "cName": "\ u7389 \ u7c73", "amount": 7, "price": "23" },{ "cId": 14, "cName ": "\ u897f \ u74dc", "amount": 7, "price": "29" },{ "cId": 5, "cName": "\ u571f \ u8c46 ", "amount": 3, "price": "24" },{ "cId": 1, "cName": "\ u8349 \ u8393", "amount": 427, "price": "27" },{ "cId": 10, "cName": "\ u5357 \ u74dc", "amount": 303, "price ": "30" },{ "cId": 11, "cName": "\ u82f9 \ u679c", "amount": 1, "price": "24 "}, {"cId": 23, "cName": "\ u77f3 \ u69b4", "amount": 4, "price": "54" },{ "cId": 18, "cName": "\ u6843 \ u5b50", "amount": 3, "price": "40" },{ "cId": 15, "cName ": "\ u9999 \ u8133", "amount": 9, "price": "32" },{ "cId": 13, "cName": "\ u8461 \ u8404 ", "amount": 7, "price": "47" },{ "cId": 26, "cName": "\ u67da \ u5b50", "amount": 1, "price": "58" },{ "cId": 27, "cName": "\ u83e0 \ u841d", "amount": 5, "price ": "62" },{ "cId": 19, "cName": "\ u6a59 \ u5b50", "amount": 27, "price": "41"}]
VS2008
Reference System. ServiceModel. Web. dll
Reference System. Runtime. Serialization. dll
Private void Form1_Load (object sender, EventArgs e)
{
String _ JsonText = System. IO. File. ReadAllText (@ "C: \ 2.TXT ");
List _ Test = new List ();
DataContractJsonSerializer _ Json = new DataContractJsonSerializer (_ Test. GetType ());
Byte [] _ Using = System. Text. Encoding. UTF8.GetBytes (_ JsonText );
System. IO. MemoryStream _ MemoryStream = new System. IO. MemoryStream (_ Using );
_ MemoryStream. Position = 0;
_ Test = (List ) _ Json. ReadObject (_ MemoryStream );
}
Public class Test
{
Public int cId = 0;
Public string cName = "";
Public int amount = 0;
Public string price = "";
}