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 ...
随机推荐
- Tomcat 集群
1. 前言 该篇中测试的机器发生了变更,在第一篇中设置的Apache DocumentRoot "d:/deployment"修改为了DocumentRoot d:/clust ...
- iOS开发——数据持久化Swift篇&通用文件存储
通用文件存储 import UIKit class ViewController: UIViewController { @IBOutlet weak var textField: UITextFie ...
- C++ typedef typename
[cpp] view plaincopy template<typename T> class A { public: typedef T a_type; }; template<t ...
- const形参和实参
当形参是const时,必须要注意关于顶层const的讨论.如前所述,顶层const的作用于对象本身: const int ci=42; //不能改变ci,const是顶层的 int i=ci: ...
- LeetCode 341. Flatten Nested List Iterator
https://leetcode.com/problems/flatten-nested-list-iterator/
- Hibernate: Truly Understanding the Second-Level and Query Caches--reference
I've written multiple articles here at Javalobby on the Hibernate O/R mapping tool, and they are usu ...
- Linux Shell产生16进制随机数
n为字符长度 openssl rand -hex n
- Lodop实现web套打
WEB套打可选方案不多,理想的更少,利用免费控件Lodop+JavaScript实现精确套打,算是较为经典的选择.这种方案其实比较简单,利用一个htm文件就可以实现模板设计过程,几乎是“空手套”式的开 ...
- touch——移动端
touch事件原生一定要用addEventListener来绑定 一.原生 touchstart:触摸开始时触发 touches:当前位于屏幕上所有手指的列表 event.touches.length ...
- 给你看看我练习的oracle语句
-------预算-- CREATE OR REPLACE VIEW V_YUSUAN_BGY_WZ20151204 AS SELECT tb_cube_fc05.pk_entity pk_org,/ ...