Json數(shù)據(jù)轉(zhuǎn)換list對(duì)象實(shí)現(xiàn)思路及代碼
[{"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 = "";
}
- Java JSON轉(zhuǎn)成List結(jié)構(gòu)數(shù)據(jù)
- python使用zip將list轉(zhuǎn)為json的方法
- Json字符串與Object、List、Map的互轉(zhuǎn)工具類(lèi)
- JSON--List集合轉(zhuǎn)換成JSON對(duì)象詳解
- 將List對(duì)象列表轉(zhuǎn)換成JSON格式的類(lèi)實(shí)現(xiàn)方法
- 將Java的List結(jié)構(gòu)通過(guò)GSON庫(kù)轉(zhuǎn)換為JSON的方法示例
- JSON的String字符串與Java的List列表對(duì)象的相互轉(zhuǎn)換
- Json轉(zhuǎn)list二層解析轉(zhuǎn)換代碼實(shí)例
相關(guān)文章
EFCore 通過(guò)實(shí)體Model生成創(chuàng)建SQL Server數(shù)據(jù)庫(kù)表腳本
這篇文章主要介紹了EFCore 通過(guò)實(shí)體Model生成創(chuàng)建SQL Server數(shù)據(jù)庫(kù)表腳本的示例,幫助大家更好的理解和學(xué)習(xí)使用.net框架,感興趣的朋友可以了解下2021-03-03ASP.NET MVC下自定義錯(cuò)誤頁(yè)和展示錯(cuò)誤頁(yè)的方式
這篇文章主要為大家詳細(xì)介紹了ASP.NET MVC下自定義錯(cuò)誤頁(yè)和展示錯(cuò)誤頁(yè)的方式,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-11-11MVC4制作網(wǎng)站教程第二章 用戶(hù)登陸2.2
這篇文章主要為大家詳細(xì)介紹了MVC4制作網(wǎng)站教程,用戶(hù)登陸功能的實(shí)現(xiàn)代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-08-08ABP(現(xiàn)代ASP.NET樣板開(kāi)發(fā)框架)系列之二、ABP入門(mén)教程詳解
ABP是為新的現(xiàn)代Web應(yīng)用程序使用最佳實(shí)踐和使用最流行工具的一個(gè)起點(diǎn)。可作為一般用途的應(yīng)用程序的基礎(chǔ)框架或項(xiàng)目模板。接下來(lái)通過(guò)本文給大家詳細(xì)介紹ABP入門(mén)教程,感興趣的朋友一起看看吧2017-10-10ASP.NET中的Menu控件的應(yīng)用及XmlDataSource的了解
以前一直以為菜單都是通過(guò)sitemap制作的,最近看到項(xiàng)目中的方法是使用XmlDataSource榜定的,很是好奇,于是研究了一下,感覺(jué)還不錯(cuò)哦,感興趣的朋友也可以了解下啊,或許本文所提供的對(duì)你學(xué)習(xí)有所幫助呢2013-02-02asp.net post方法中參數(shù)取不出來(lái)的解決方法
調(diào)試client端調(diào)用web api的代碼,服務(wù)器端的post方法的參數(shù)死活取不出來(lái),下面有個(gè)不錯(cuò)的解決方法,希望對(duì)大家有所幫助2014-01-01asp.net core MVC之實(shí)現(xiàn)基于token的認(rèn)證
這篇文章主要介紹了asp.net core MVC之實(shí)現(xiàn)基于token的認(rèn)證,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-05-05