当前位置:网站首页>Use C language to receive JSON strings
Use C language to receive JSON strings
2022-07-02 08:12:00 【Ren yabing】
Use C# Language to carry on json Receiving of string
Using tools :vs2019
Method :
1. Get what you want to accept json object , such as :
{
“face_token”: “fid”,
“user_list”: [
{
“group_id” : “test1”,
“user_id”: “u333333”,
“user_info”: “Test User”,
“score”: 99.3
}
]
}
2. Prepare an entity class to accept json object
3. First step json Objects are copied to the clipboard , Then proceed as follows
The result is :
It can be seen that RootObject Medium user_List[] The array contains User_List class
Use code to accept object code
var result = Client().FaceGetlist(userID, groupID);
JToken jToken = JToken.Parse(result.ToString());
// Get error code
int error_code = int.Parse(jToken["error_code"].ToString());
if (error_code == 0)
{
string resultString = Convert.ToString(result);
Rootobject rootobject = JsonConvert.DeserializeObject<Rootobject>(resultString);
foreach (var list in rootobject.result.face_list)
{
faceTokenString.Add(Convert.ToString(list.face_token));
}
}
Rootobject rootobject = JsonConvert.DeserializeObject(resultString); To receive objects
This is the reference you need :
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Collections;
using System.Net;
using System.Drawing;
边栏推荐
- 11月24号,我们为“满月”庆祝
- Hystrix dashboard cannot find hystrix Stream solution
- [learning notes] matlab self compiled Gaussian smoother +sobel operator derivation
- 学习写文章格式
- I'll show you why you don't need to log in every time you use Taobao, jd.com, etc?
- Open3d learning notes 1 [first glimpse, file reading]
- Opencv's experience of confusing X and Y coordinates
- 多站点高可用部署
- Vscode下中文乱码问题
- OpenCV关于x,y坐标容易混淆的心得
猜你喜欢
Real world anti sample attack against semantic segmentation
使用C#语言来进行json串的接收
Sqlyog remote connection to MySQL database under centos7 system
Matlab数学建模工具
樂理基礎(簡述)
11月24号,我们为“满月”庆祝
Several methods of image enhancement and matlab code
Simply test the two different data transmission methods of content length and chunked
Use of OpenCV 6.4 median filter
浅谈深度学习模型中的后门
随机推荐
On the confrontation samples and their generation methods in deep learning
用C# 语言实现MYSQL 真分页
深入理解JVM
Force deduction method summary: find classes
Carsim problem failed to start Solver: Path Id Obj (X) was set to y; Aucune valeur de correction de xxxxx?
Common shortcut keys of Jupiter notebook (you can also view it by pressing h in command mode)
Data reverse attack under federated learning -- gradinversion
Command line is too long
C语言的库函数
我的vim配置文件
力扣方法总结:滑动窗口
图像增强的几个方法以及Matlab代码
Cvpr19 deep stacked hierarchical multi patch network for image deblurring paper reproduction
Static library and dynamic library
Open3d learning note 3 [sampling and voxelization]
王-课外单词
Where do you find the materials for those articles that have read 10000?
Summary of one question per day: String article (continuously updated)
Get the width and height of the screen in real time (adaptive)
Target detection for long tail distribution -- balanced group softmax