将JSON解析为dataTable, 把orderInfo、supplierInfo、itemList 数据取出放到DataTable里,如何取
将JSON解析为dataTable, 把orderInfo、supplierInfo、itemList 数据取出放到DataTable里,怎么取?
{
"code": "1",
"message": "",
"data": [
{
"orderInfo": {
"orderId": 11,
"totalAmount": 22,
"remark": 33,
"printId": 44,
"printCount": 55,
"lastPrintTime": 66,
"placeOrderTime": 77,
"arriveExpectTime": 88,
"orderStatus": 99,
"shouHuoRen": 888,
"contactWay": 111,
"storeName": 222,
"placeOrderTrip": 333,
"province": 444,
"city": 555,
"area": 666,
"street": 777,
"address": 888
},
"supplierInfo": {
"supplierName": "qqq",
"contactor": "www",
"contactWay": "eee",
"songhuoxingcheng": "rrr",
"qiDingJin": "ttt",
"province": "yyy",
"city": "uu",
"area": "iqqi",
"street": "uusss",
"address": "uddu",
"orderAd": "uurr"
},
"itemList": [
{
"itemId": "wwweeee",
"barcode": "wwweeee",
"itemNo": "wwweeee",
"itemName": "wwweeee",
"ruShu": "wwweeee",
"unit": "wwweeee",
"otCount": 10,
"price": 60,
"totalPrice": 600
}
]
}
]
}
------解决思路----------------------
Newtonsoft.Json反序列化
{
"code": "1",
"message": "",
"data": [
{
"orderInfo": {
"orderId": 11,
"totalAmount": 22,
"remark": 33,
"printId": 44,
"printCount": 55,
"lastPrintTime": 66,
"placeOrderTime": 77,
"arriveExpectTime": 88,
"orderStatus": 99,
"shouHuoRen": 888,
"contactWay": 111,
"storeName": 222,
"placeOrderTrip": 333,
"province": 444,
"city": 555,
"area": 666,
"street": 777,
"address": 888
},
"supplierInfo": {
"supplierName": "qqq",
"contactor": "www",
"contactWay": "eee",
"songhuoxingcheng": "rrr",
"qiDingJin": "ttt",
"province": "yyy",
"city": "uu",
"area": "iqqi",
"street": "uusss",
"address": "uddu",
"orderAd": "uurr"
},
"itemList": [
{
"itemId": "wwweeee",
"barcode": "wwweeee",
"itemNo": "wwweeee",
"itemName": "wwweeee",
"ruShu": "wwweeee",
"unit": "wwweeee",
"otCount": 10,
"price": 60,
"totalPrice": 600
}
]
}
]
}
------解决思路----------------------
class A
{ public string code{get;set;}
public string message{get;set;}
public List<B> data{get;set;}
}
class B
{
public order orderInfo{get;set;}
public supplier supplierInfo{get;set;}
public List<Item> itemList{get;set;}
}
class order
{
public int orderId{get;set;}
//其它属性补全
}
//supplier和item一样定义
Newtonsoft.Json反序列化