亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何將Json數據轉換成list對象

發布時間:2021-02-23 16:57:42 來源:億速云 閱讀:964 作者:Leah 欄目:開發技術

這期內容當中小編將會給大家帶來有關如何將Json數據轉換成list對象,文章內容豐富且以專業的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

JSON代碼

[{"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\u8549","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
引用System.ServiceModel.Web.dll
引用System.Runtime.Serialization.dll

復制代碼 代碼如下:


private void Form1_Load(object sender, EventArgs e)
{
string _JsonText = System.IO.File.ReadAllText(@"C:\2.TXT");
List<Test> _Test = new List<Test>();
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<Test>)_Json.ReadObject(_MemoryStream);
}
public class Test
{
public int cId = 0;
public string cName = "";
public int amount = 0;
public string price = "";
}

上述就是小編為大家分享的如何將Json數據轉換成list對象了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關知識,歡迎關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

石家庄市| 临汾市| 巴青县| 六枝特区| 曲阜市| 三门县| 九寨沟县| 福建省| 河曲县| 横山县| 江口县| 连江县| 咸宁市| 西吉县| 呼玛县| 集贤县| 巫山县| 苗栗县| 阳泉市| 绥芬河市| 蒲城县| 雷州市| 唐河县| 清苑县| 若尔盖县| 罗甸县| 呼图壁县| 蛟河市| 石城县| 丰宁| 宁远县| 宜阳县| 阳朔县| 宕昌县| 赤水市| 灌云县| 张家川| 雅安市| 宜丰县| 新昌县| 玛纳斯县|