当前位置:网站首页>Parsing methods of JSON data in C - jar and jobobject: error reading jar from jsonreader Current JsonReader item
Parsing methods of JSON data in C - jar and jobobject: error reading jar from jsonreader Current JsonReader item
2022-04-23 20:24:00 【First code】
generally speaking , Although the data format returned to us by the data interface is json Format , But different formats use different parsing methods , It is mainly divided into array type and non array type , The difference between the two formats is as follows :
Array type :( There is an array of packages on the outside )
string jsonText = "[{'a':'aaa','b':'bbb','c':'ccc'},{'a':'aa','b':'bb,'c':'cc'}]";
Use JArray The way
string jsonText = "[{'a':'aaa','b':'bbb','c':'ccc'},{'a':'aa','b':'bb,'c':'cc'}]";
var mJObj = JArray.Parse(jsonText t);
// demand , Delete... From the list a The value of the node is 'aa' The item
IList<JToken> delList = new List<JToken>(); // Store items that need to be deleted
foreach (var ss in mJObj ) // Find a field and value
{
if(((JObject) ss)["a"]=='aa')
delList .add(ss);
}
foreach (var item in delList ) // remove mJObj stay delList Items in
{
mJObj .remove(item);
}
Non array type :( No array wrapping in the outer layer )
{'a':'aaa','b':'bbb','c':'ccc'}
Use JObecj The way
//2.2 Non array use JObject load ( Here we mainly take this as an example )
string jsonText = "{'a':'aaa','b':'bbb','c':'ccc'}";
var mJObj = JObject.Parse(jsonText t);
mJObj.Add() // newly added , Never tried.
var v1=mJObj[a].ToString() // obtain 'aaa' Value
版权声明
本文为[First code]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210551267632.html
边栏推荐
- How about CICC fortune? Is it safe to open an account
- Shanghai responded that "flour official website is an illegal website": neglect of operation and maintenance has been "hacked", and the police have filed a case
- 6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
- Is the wechat CICC wealth high-end zone safe? How to open an account for securities
- Browser - learning notes
- Error reported by Azkaban: Azkaban jobExecutor. utils. process. ProcessFailureException: Process exited with code 64
- What is the difference between a host and a server?
- Customize timeline component styles
- Commit and ROLLBACK in DCL of 16mysql
- R language uses timeroc package to calculate the multi time AUC value of survival data under competitive risk, uses Cox model and adds covariates, and R language uses the plotauccurve function of time
猜你喜欢

Latest investigation and progress of building intelligence based on sati

Redis cache penetration, cache breakdown, cache avalanche

Commit and rollback in DCL of 16 MySQL
![[PTA] l1-002 printing hourglass](/img/9e/dc715f7debf7edb7a40e9ecfa69cef.png)
[PTA] l1-002 printing hourglass

After route link navigation, the sub page does not display the navigation style problem

Installation and use of NVM

Sqoop imports tinyint type fields to boolean type

Click an EL checkbox to select all questions

Mysql database backup scheme
![[graph theory brush question-4] force deduction 778 Swimming in a rising pool](/img/e3/a8cd9fc7773843e9e8ee6a6eba123f.png)
[graph theory brush question-4] force deduction 778 Swimming in a rising pool
随机推荐
Notes of Tang Shu's grammar class in postgraduate entrance examination English
Intersection calculation of straight line and plane in PCL point cloud processing (53)
Why does ES6 need to introduce map when JS already has object type
【PTA】L2-011 玩转二叉树
Mysql database backup scheme
R language uses the preprocess function of caret package for data preprocessing: BoxCox transform all data columns (convert non normal distribution data columns to normal distribution data and can not
Scrapy教程 - (2)寫一個簡單爬蟲
Modeling based on catiav6
WordPress插件:WP-China-Yes解决国内访问官网慢的方法
LeetCode 74、搜索二维矩阵
LeetCode 709、转换成小写字母
star
The construction and use of Fortress machine and springboard machine jumpserver are detailed in pictures and texts
The flinkcdc reports an error: but this is no longer available on the server
Cadence Orcad Capture CIS更换元器件之Link Database 功能介绍图文教程及视频演示
SQL Server connectors by thread pool 𞓜 instructions for dtsqlservertp plug-in
Rt-1052 learning notes - GPIO architecture analysis
[PTA] get rid of singles
How does onlyoffice solve no route to host
. Ren -- the intimate artifact in the field of vertical Recruitment!