当前位置:网站首页>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
边栏推荐
- LeetCode 709、转换成小写字母
- Analysis of the relationship between generalized Bim and CAD under the current background
- Computing the intersection of two planes in PCL point cloud processing (51)
- bounding box iou
- Livego + ffmpeg + RTMP + flvjs to realize live video
- Cadence OrCAD capture batch change component packaging function introduction graphic tutorial and video demonstration
- Servlet learning notes
- Numpy sort search count set
- XXXI` Prototype ` displays prototype properties and`__ proto__` Implicit prototype properties
- Es keyword sorting error reason = fielddata is disabled on text fields by default Set fielddata = true on keyword in order
猜你喜欢

An error is reported when sqoop imports data from Mysql to HDFS: sqlexception in nextkeyvalue

WordPress插件:WP-China-Yes解决国内访问官网慢的方法

selenium.common.exceptions.WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT

Some basic knowledge of devexpress report development

Numpy mathematical function & logical function

PCL点云处理之计算两平面交线(五十一)

Automatically fill in body temperature and win10 task plan

What is the difference between a host and a server?

Latest investigation and progress of building intelligence based on sati

Scripy tutorial - (2) write a simple crawler
随机推荐
Commit and ROLLBACK in DCL of 16mysql
論文寫作 19: 會議論文與期刊論文的區別
Commit and rollback in DCL of 16 MySQL
16MySQL之DCL 中 COMMIT和ROllBACK
[problem solving] 'ASCII' codec can't encode characters in position XX XX: ordinal not in range (128)
上海回應“面粉官網是非法網站”:疏於運維被“黑”,警方已立案
LeetCode 1337、矩阵中战斗力最弱的 K 行
Error reported by Azkaban: Azkaban jobExecutor. utils. process. ProcessFailureException: Process exited with code 127
Use the rolling division method to find the maximum common divisor of two numbers
DTMF dual tone multi frequency signal simulation demonstration system
[graph theory brush question-5] Li Kou 1971 Find out if there is a path in the graph
How can matlab obtain the truncated image in trainingimagelabeler
Introduction to link database function of cadence OrCAD capture CIS replacement components, graphic tutorial and video demonstration
堡垒机、跳板机JumpServer的搭建,以及使用,图文详细
Scrapy教程 - (2)寫一個簡單爬蟲
Recognition of high-speed road signs by Matlab using alexnet
Numpy sort search count set
PostgreSQL basic functions
SIGIR'22 "Microsoft" CTR estimation: using context information to promote feature representation learning
Es error: request contains unrecognized parameter [ignore_throttled]