当前位置:网站首页>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
边栏推荐
- Azkaban recompile, solve: could not connect to SMTP host: SMTP 163.com, port: 465 [January 10, 2022]
- 【问题解决】‘ascii‘ codec can‘t encode characters in position xx-xx: ordinal not in range(128)
- Mysql database and table building: the difference between utf8 and utf8mb4
- How to protect ECs from hacker attacks?
- 上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
- [graph theory brush question-4] force deduction 778 Swimming in a rising pool
- Investigate why close is required after sqlsession is used in mybatties
- LeetCode 20、有效的括号
- Leetcode dynamic planning training camp (1-5 days)
- Browser - learning notes
猜你喜欢
BMP JPEG 图片转换为矢量图像 ContourTrace
Scrapy教程 - (2)寫一個簡單爬蟲
LeetCode 542、01 矩阵
Three. Based on ply format point cloud voxel model JS upload interface writing
Redis cache penetration, cache breakdown, cache avalanche
RT-1052学习笔记 - GPIO架构分析
. Ren -- the intimate artifact in the field of vertical Recruitment!
Actual measurement of automatic ticket grabbing script of barley network based on selenium (the first part of the new year)
selenium. common. exceptions. WebDriverException: Message: ‘chromedriver‘ executable needs to be in PAT
上海回应“面粉官网是非法网站”:疏于运维被“黑”,警方已立案
随机推荐
LeetCode 232、用栈实现队列
Es index (document name) fuzzy query method (database name fuzzy query method)
【PTA】整除光棍
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
Tencent Qiu Dongyang: techniques and ways of accelerating deep model reasoning
The market share of the financial industry exceeds 50%, and zdns has built a solid foundation for the financial technology network
DTMF dual tone multi frequency signal simulation demonstration system
WordPress插件:WP-China-Yes解决国内访问官网慢的方法
堡垒机、跳板机JumpServer的搭建,以及使用,图文详细
JDBC tool class jdbcfiledateutil uploads files and date format conversion, including the latest, simplest and easiest way to upload single files and multiple files
【问题解决】‘ascii‘ codec can‘t encode characters in position xx-xx: ordinal not in range(128)
6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
Research on open source OCR engine
How about CICC fortune? Is it safe to open an account
Numpy Index & slice & iteration
Common form verification
Sqoop imports tinyint type fields to boolean type
JDBC database addition, deletion, query and modification tool class
SQL Server Connectors By Thread Pool | DTSQLServerTP plugin instructions
考研英语唐叔的语法课笔记