当前位置:网站首页>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
边栏推荐
- Paper writing 19: the difference between conference papers and journal papers
- 2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
- Three. Based on ply format point cloud voxel model JS upload interface writing
- Experience of mathematical modeling in 18 year research competition
- [talkative cloud native] load balancing - the passenger flow of small restaurants has increased
- 【栈和队列专题】—— 滑动窗口
- What is the difference between a host and a server?
- Shanghai a répondu que « le site officiel de la farine est illégal »: l'exploitation et l'entretien négligents ont été « noirs » et la police a déposé une plainte
- Analysis of the relationship between generalized Bim and CAD under the current background
- SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
猜你喜欢
PCL点云处理之计算两平面交线(五十一)
. Ren -- the intimate artifact in the field of vertical Recruitment!
DNS cloud school | analysis of hidden tunnel attacks in the hidden corner of DNS
DNS cloud school rising posture! Three advanced uses of authoritative DNS
考研英语唐叔的语法课笔记
Numpy Index & slice & iteration
[graph theory brush question-5] Li Kou 1971 Find out if there is a path in the graph
Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high
Some basic configurations in interlij idea
Recommend an open source free drawing software draw IO exportable vector graph
随机推荐
Plato Farm元宇宙IEO上线四大,链上交易颇高
How can matlab obtain the truncated image in trainingimagelabeler
LeetCode 709、转换成小写字母
LeetCode 232、用栈实现队列
Mathematical modeling column | Part 5: MATLAB optimization model solving method (Part I): Standard Model
6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
. Ren -- the intimate artifact in the field of vertical Recruitment!
Es error: request contains unrecognized parameter [ignore_throttled]
Computing the intersection of two planes in PCL point cloud processing (51)
Shanghai a répondu que « le site officiel de la farine est illégal »: l'exploitation et l'entretien négligents ont été « noirs » et la police a déposé une plainte
Experience of mathematical modeling in 18 year research competition
The ODB model calculates the data and outputs it to excel
[PTA] l1-002 printing hourglass
How does onlyoffice solve no route to host
DNS cloud school | analysis of hidden tunnel attacks in the hidden corner of DNS
A useless confession artifact
堡垒机、跳板机JumpServer的搭建,以及使用,图文详细
Cadence OrCAD capture batch change component packaging function introduction graphic tutorial and video demonstration
Thirty What are VM and VC?
2022dasctf APR x fat epidemic prevention challenge crypto easy_ real