Newtonsoft.Json.dll解析json的dll文件使用
要解析的json
//解析前
//解析前
{"orderlist":[{"backPrice":,"businessId":,"businessNotes":"","couponNo":"","createTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"customerId":,"customerNickname":"","customerRemark":"","dealerType":"","delFlag":"","distTrue":"","duShuPrice":"","evaluateFlag":"","expressDate":"","expressPrice":,"fhPrice":"","getGoodsTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"goodslist":[],"invoiceContent":"","invoiceTitle":"","invoiceType":"","orderCancelRemark":"","orderCancelTime":null,"orderCode":"","orderId":,"orderIntegral":,"orderOldCode":"","orderOldPrice":,"orderPrePrice":,"orderPrePriceOrder":,"orderPrice":,"orderRemark":"","orderStatus":"","payId":,"payTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"sendExpressTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"shippingAddress":"山西路43号省地税直属局","shippingCity":"南京","shippingCounty":"鼓楼区","shippingMobile":"","shippingPerson":"李玲","shippingPhone":"","shippingPostcode":"","shippingProvince":"江苏","shoppingAddrId":,"unionPrice":"0.00","vipPrice":"321.00"},{"backPrice":,"businessId":,"businessNotes":"","couponNo":"","createTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"customerId":,"customerNickname":"","customerRemark":"","dealerType":"","delFlag":"","distTrue":"","duShuPrice":"199.20","evaluateFlag":"","expressDate":"","expressPrice":,"fhPrice":"","getGoodsTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"goodslist":[],"invoiceContent":"","invoiceTitle":"","invoiceType":"","orderCancelRemark":"","orderCancelTime":null,"orderCode":"","orderId":,"orderIntegral":,"orderOldCode":"","orderOldPrice":199.2,"orderPrePrice":,"orderPrePriceOrder":,"orderPrice":199.2,"orderRemark":"","orderStatus":"","payId":,"payTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"sendExpressTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"shippingAddress":"草场门大街88号江苏建设大厦2楼计划财务处","shippingCity":"南京","shippingCounty":"鼓楼区","shippingMobile":"","shippingPerson":"陈明伟","shippingPhone":"","shippingPostcode":"","shippingProvince":"江苏","shoppingAddrId":,"unionPrice":"0.00","vipPrice":""},{"backPrice":,"businessId":,"businessNotes":"","couponNo":"","createTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"customerId":,"customerNickname":"","customerRemark":"","dealerType":"","delFlag":"","distTrue":"","duShuPrice":"","evaluateFlag":"","expressDate":"","expressPrice":,"fhPrice":"","getGoodsTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"goodslist":[],"invoiceContent":"","invoiceTitle":"","invoiceType":"","orderCancelRemark":"","orderCancelTime":null,"orderCode":"","orderId":,"orderIntegral":,"orderOldCode":"","orderOldPrice":,"orderPrePrice":,"orderPrePriceOrder":,"orderPrice":,"orderRemark":"","orderStatus":"","payId":,"payTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"sendExpressTime":{"date":,"day":,"hours":,"minutes":,"month":,"seconds":,"time":,"timezoneOffset":-,"year":},"shippingAddress":"亭湖区黄海中路1号翰香花园1号楼705室13851180736","shippingCity":"盐城","shippingCounty":"盐城市","shippingMobile":"","shippingPerson":"仇玉海。晏泉","shippingPhone":"","shippingPostcode":"","shippingProvince":"江苏","shoppingAddrId":,"unionPrice":"0.00","vipPrice":"214.00"}],"status":"A001"}
个人用来记忆的,高手勿喷
1,开始解析
//ret表示要解析的json
var t = Newtonsoft.Json.JsonConvert.DeserializeObject(ret).ToString();
2,解析后
{
"orderlist": [
{
"backPrice": ,
"businessId": ,
"businessNotes": "",
"couponNo": "",
"createTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"customerId": ,
"customerNickname": "",
"customerRemark": "",
"dealerType": "",
"delFlag": "",
"distTrue": "",
"duShuPrice": "",
"evaluateFlag": "",
"expressDate": "",
"expressPrice": ,
"fhPrice": "",
"getGoodsTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"goodslist": [],
"invoiceContent": "",
"invoiceTitle": "",
"invoiceType": "",
"orderCancelRemark": "",
"orderCancelTime": null,
"orderCode": "",
"orderId": ,
"orderIntegral": ,
"orderOldCode": "",
"orderOldPrice": ,
"orderPrePrice": ,
"orderPrePriceOrder": ,
"orderPrice": ,
"orderRemark": "",
"orderStatus": "",
"payId": ,
"payTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"sendExpressTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"shippingAddress": "山西路43号省地税直属局",
"shippingCity": "南京",
"shippingCounty": "鼓楼区",
"shippingMobile": "",
"shippingPerson": "李玲",
"shippingPhone": "",
"shippingPostcode": "",
"shippingProvince": "江苏",
"shoppingAddrId": ,
"unionPrice": "0.00",
"vipPrice": "321.00"
},
{
"backPrice": ,
"businessId": ,
"businessNotes": "",
"couponNo": "",
"createTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"customerId": ,
"customerNickname": "",
"customerRemark": "",
"dealerType": "",
"delFlag": "",
"distTrue": "",
"duShuPrice": "199.20",
"evaluateFlag": "",
"expressDate": "",
"expressPrice": ,
"fhPrice": "",
"getGoodsTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"goodslist": [],
"invoiceContent": "",
"invoiceTitle": "",
"invoiceType": "",
"orderCancelRemark": "",
"orderCancelTime": null,
"orderCode": "",
"orderId": ,
"orderIntegral": ,
"orderOldCode": "",
"orderOldPrice": 199.2,
"orderPrePrice": ,
"orderPrePriceOrder": ,
"orderPrice": 199.2,
"orderRemark": "",
"orderStatus": "",
"payId": ,
"payTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"sendExpressTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"shippingAddress": "草场门大街88号江苏建设大厦2楼计划财务处",
"shippingCity": "南京",
"shippingCounty": "鼓楼区",
"shippingMobile": "",
"shippingPerson": "陈明伟",
"shippingPhone": "",
"shippingPostcode": "",
"shippingProvince": "江苏",
"shoppingAddrId": ,
"unionPrice": "0.00",
"vipPrice": ""
},
{
"backPrice": ,
"businessId": ,
"businessNotes": "",
"couponNo": "",
"createTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"customerId": ,
"customerNickname": "",
"customerRemark": "",
"dealerType": "",
"delFlag": "",
"distTrue": "",
"duShuPrice": "",
"evaluateFlag": "",
"expressDate": "",
"expressPrice": ,
"fhPrice": "",
"getGoodsTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"goodslist": [],
"invoiceContent": "",
"invoiceTitle": "",
"invoiceType": "",
"orderCancelRemark": "",
"orderCancelTime": null,
"orderCode": "",
"orderId": ,
"orderIntegral": ,
"orderOldCode": "",
"orderOldPrice": ,
"orderPrePrice": ,
"orderPrePriceOrder": ,
"orderPrice": ,
"orderRemark": "",
"orderStatus": "",
"payId": ,
"payTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"sendExpressTime": {
"date": ,
"day": ,
"hours": ,
"minutes": ,
"month": ,
"seconds": ,
"time": ,
"timezoneOffset": -,
"year":
},
"shippingAddress": "亭湖区黄海中路1号翰香花园1号楼705室13851180736",
"shippingCity": "盐城",
"shippingCounty": "盐城市",
"shippingMobile": "",
"shippingPerson": "仇玉海。晏泉",
"shippingPhone": "",
"shippingPostcode": "",
"shippingProvince": "江苏",
"shoppingAddrId": ,
"unionPrice": "0.00",
"vipPrice": "214.00"
}
],
"status": "A001"
}
3,根据解析后的json,用JObject.Parse(t)[]获取对应数据
List<JToken> list = JObject.Parse(t)["orderlist"].ToList();

4,循环list
Newtonsoft.Json.dll解析json的dll文件使用的更多相关文章
- Python | JSON 数据解析(Json & JsonPath)
一.什么是JSON? JSON(JavaScript Object Notation, JS 对象简谱) 是一种轻量级的数据交换格式.它基于 ECMAScript (欧洲计算机协会制定的js规范)的一 ...
- JSON.stringify()方法是将一个javascript值(对象或者数组)转换成为一个JSON字符串;JSON.parse()解析JSON字符串,构造由字符串描述的javascript值或对象
JSON.stringify()方法是将一个javascript值(对象或者数组)转换成为一个JSON字符串:JSON.parse()解析JSON字符串,构造由字符串描述的javascript值或对象
- C#使用Json.NET解析Json
本文转载自 http://xiaosheng.me/2016/10/01/article25/ 最近在 C# 项目中需要使用到 Json 格式的数据,我简单上网搜索了一下,基本上有两种操作 Json ...
- Python3基础 json.loads 解析json格式的数据,得到一个字典
Python : 3.7.0 OS : Ubuntu 18.04.1 LTS IDE : PyCharm 2018.2.4 Conda ...
- JSON.parse 解析json字符串时,遇换行符报错
Json字符串转换成Json对象时候,有两种方式: 假设d是json字符串: 1,eval('(' + d + ')'). 2,JSON.parse(d): 但是以上方式有隐患,如果Json字符串有换 ...
- Android原生生成JSON与解析JSON
JSON数据是一种轻量级的数据交换格式,在Android中通常应用于client与server交互之间的传输数据.像如今在网上有非常多解析JSON数据的jar包,可是归根究竟用的都是Android原生 ...
- scala解析json —— json4s 解析json方法汇总
使用json4s的框架,包括spark,flink 1.org.json4s 引入pom的方法 对于本地支持,引入以下依赖项添加到pom中 <dependency> <groupId ...
- JSON.parse 解析json字符串时,遇字符串换行符,解析失败
今天遇到json字符串转对象时报错了,发现有个字符串有换行符,仔细找了原因. 结果是因为JSON.parse转json字符串时遇到一些特殊字符需要先转义,如图所示 然后尝试了各路大神介绍的办法,均不适 ...
- Newtonsoft.Json 动态解析 json字符串
有一个json字符串是动态的,如下面,columns中的数量是不固定的,因此就不能使用反序列化类的方法了: 因此使用这样一种方式,把columns中的所有东西都输出出来: public void Ge ...
随机推荐
- nonce和timestamp在Http安全协议中的作用
前段时间给客户网站做新浪微博账号登录功能,对OAuth协议以及相关的一些安全协议做了一些研究,顺便就记录一下学习心得吧.在这里就不打算具体讲OAuth的协议流程了,而是针对OAuth请求头里的nonc ...
- android学习日记20--连接组件之Intent和IntentFilter
上次刚了解完Android的四大组件,现在学习组件间通信的Intent和IntentFilter 一.Intent 1.简述 Intent(意图)在应用程序运行时连接两个不同组件,是一种运行时的绑定机 ...
- 二、Socket之UDP异步传输文件
上一篇文章一.Socket之UDP异步传输文件中,实现了文件的基本传输,但是传输过程中的信息是看不到的,这一篇是对上一篇进行了一些改进,并且可以了解传输的信息(加入了Log),还加入了接收或者拒绝接收 ...
- BugZilla的安装过程简明教程
Bugzilla+Mysql+iis+perl模块+ ActivePerl 安装过程 (原:http://www.cnblogs.com/Warmsunshine/archive/2012/03/25 ...
- GCD多线程
GCD本质线程自动管理指令包 GCD优点: 1.GCD 本身自带有线程锁的效果,能通过推迟昂贵计算任务并在后台运行它们来改善应用的响应性能. 2.GCD 提供了更易于使用的并发模型(效果方面类似于对锁 ...
- Asp.Net 5使用Area及自定义Area
Asp.Net Mvc里有一个叫做Area的技术,就是可以把不同逻辑组件的controller, view等放到不同的文件夹里.比如所有管理相关的都放到Admin area里.其实之前我一直对这个功能 ...
- VIM 分割窗口
VIM 分割窗口 *08.1* 分割窗口 打开新窗口最简单的命令如下: :split 这个命令把屏幕分解成两个窗口并把光标置于上面的窗口中: +----------------------- ...
- C# 重新改变数组的长度
重新改变数组的长度 System.Array.Resize(ref FieldName, j);
- Programme skills
1. Dynamic library 2. Template class. function template<typename T> classs Sample { ... templa ...
- Android 自学之相对布局 RelativeLayout
相对布局(RelativeLayout),相对布局容器内子组件的位置总是相对兄弟组件.父容器来决定的. RelativeLayout的XML属性及相关方法说明 XML属性 相关方法 说明 androi ...