当前位置:网站首页>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;
边栏推荐
- STL速查手册
- How to back up the configuration before the idea when reinstalling the idea
- Nacos service registration in the interface
- A brief analysis of graph pooling
- Global and Chinese markets for Salmonella typhi nucleic acid detection kits 2022-2028: Research Report on technology, participants, trends, market size and share
- Opencv's experience of confusing X and Y coordinates
- On the back door of deep learning model
- Find and rfind methods in string
- 针对tqdm和print的顺序问题
- SQL server如何卸载干净
猜你喜欢
w10升级至W11系统,黑屏但鼠标与桌面快捷方式能用,如何解决
OpenCV 6.4 中值滤波器的使用
On the back door of deep learning model
On November 24, we celebrate the "full moon"
In the era of short video, how to ensure that works are more popular?
静态库和动态库
Programmers can only be 35? The 74 year old programmer in the United States has been programming for 57 years and has not retired
Vs code configuration problem
联邦学习下的数据逆向攻击 -- GradInversion
Carla-ue4editor import Roadrunner map file (nanny level tutorial)
随机推荐
Summary of one question per day: linked list (continuously updated)
Force deduction method summary: double pointer
Using transformer for object detection and semantic segmentation
王-课外单词
Vscode下中文乱码问题
Open3d learning note 3 [sampling and voxelization]
笔记本电脑卡顿问题原因
Library function of C language
OpenCV关于x,y坐标容易混淆的心得
On the confrontation samples and their generation methods in deep learning
St-link connection error invalid ROM table of STM32 difficult and miscellaneous diseases
Vs code configuration problem
Data reverse attack under federated learning -- gradinversion
VS Code配置问题
关于原型图的深入理解
Embedding malware into neural networks
[learning notes] matlab self compiled image convolution function
[C # note] the data in DataGridView saved in WinForm is excel and CSV
用MLP代替掉Self-Attention
Go functions make, slice, append