当前位置:网站首页>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
边栏推荐
- Common form verification
- How does onlyoffice solve no route to host
- Sqoop imports data from Mysql to HDFS using lzop compression format and reports NullPointerException
- Some basic knowledge of devexpress report development
- Mathematical modeling column | Part 5: MATLAB optimization model solving method (Part I): Standard Model
- BMP JPEG 图片转换为矢量图像 ContourTrace
- 2022DASCTF Apr X FATE 防疫挑战赛 CRYPTO easy_real
- An error is reported in the initialization metadata of the dolphin scheduler -- it turns out that there is a special symbol in the password. "$“
- LeetCode 709、转换成小写字母
- WordPress plug-in: WP CHINA Yes solution to slow domestic access to the official website
猜你喜欢

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
![[latex] 5 how to quickly write out the latex formula corresponding to the formula](/img/1f/3c5a332ce1d6852dde38040faea5bf.png)
[latex] 5 how to quickly write out the latex formula corresponding to the formula

堡垒机、跳板机JumpServer的搭建,以及使用,图文详细

Servlet learning notes

Plato farm is one of the four largest online IEOS in metauniverse, and the transaction on the chain is quite high

Devexpress 14.1 installation record

Computing the intersection of two planes in PCL point cloud processing (51)
![[stack and queue topics] - sliding window](/img/65/a2ce87f1401d7a28d4cce0cc85175f.png)
[stack and queue topics] - sliding window

Livego + ffmpeg + RTMP + flvjs to realize live video

The ODB model calculates the data and outputs it to excel
随机推荐
Three. Based on ply format point cloud voxel model JS upload interface writing
The flinkcdc reports an error: but this is no longer available on the server
Livego + ffmpeg + RTMP + flvjs to realize live video
Rédaction de thèses 19: différences entre les thèses de conférence et les thèses périodiques
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
An error is reported in the initialization metadata of the dolphin scheduler -- it turns out that there is a special symbol in the password. "$“
R language uses econocrats package to create microeconomic or macroeconomic map, visualize indifference function indifference curve, customize calculation intersection, and customize the parameters of
考研英语唐叔的语法课笔记
LeetCode 232、用栈实现队列
JDBC tool class jdbcconutil gets the connection to the database
Browser - learning notes
6-5 字符串 - 2. 字符串复制(赋值) (10 分)C语言标准函数库中包括 strcpy 函数,用于字符串复制(赋值)。作为练习,我们自己编写一个功能与之相同的函数。
Mysql database and table building: the difference between utf8 and utf8mb4
16MySQL之DCL 中 COMMIT和ROllBACK
Introduction to link database function of cadence OrCAD capture CIS replacement components, graphic tutorial and video demonstration
Actual measurement of automatic ticket grabbing script of barley network based on selenium (the first part of the new year)
ArcGIS JS version military landmark drawing (dovetail arrow, pincer arrow, assembly area) fan and other custom graphics
A useless confession artifact
[target tracking] pedestrian attitude recognition based on frame difference method combined with Kalman filter, with matlab code
Linux64Bit下安装MySQL5.6-不能修改root密码