当前位置:网站首页>使用C#语言来进行json串的接收
使用C#语言来进行json串的接收
2022-07-02 06:27:00 【任亚兵】
使用C#语言来进行json串的接收
使用工具 :vs2019
方法:
1.获取要接受的json对象,比如:
{
“face_token”: “fid”,
“user_list”: [
{
“group_id” : “test1”,
“user_id”: “u333333”,
“user_info”: “Test User”,
“score”: 99.3
}
]
}
2.准备一个实体类接受json对象

3.第一步的json对象复制到剪切板,之后进行如下操作
结果为:
可以看出RootObject中的 user_List[] 数组包含 User_List类
使用使用代码接受对象代码
var result = Client().FaceGetlist(userID, groupID);
JToken jToken = JToken.Parse(result.ToString());
//获取错误码
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);来进行接收对象
这是所需要的引用:
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;
边栏推荐
- Mmdetection trains its own data set -- export coco format of cvat annotation file and related operations
- Open3d learning notes 1 [first glimpse, file reading]
- Faster-ILOD、maskrcnn_ Benchmark training coco data set and problem summary
- Faster-ILOD、maskrcnn_ Benchmark installation process and problems encountered
- Summary of solving the Jetson nano installation onnx error (error: failed building wheel for onnx)
- How gensim freezes some word vectors for incremental training
- 【BiSeNet】《BiSeNet:Bilateral Segmentation Network for Real-time Semantic Segmentation》
- 【Mixed Pooling】《Mixed Pooling for Convolutional Neural Networks》
- What if the notebook computer cannot run the CMD command
- 【双目视觉】双目立体匹配
猜你喜欢

【Hide-and-Seek】《Hide-and-Seek: A Data Augmentation Technique for Weakly-Supervised Localization xxx》

超时停靠视频生成
![[binocular vision] binocular correction](/img/fe/27fda48c36ca529eec21c631737526.png)
[binocular vision] binocular correction

【Batch】learning notes

Installation and use of image data crawling tool Image Downloader

Faster-ILOD、maskrcnn_ Benchmark installation process and problems encountered

利用Transformer来进行目标检测和语义分割

Thesis writing tip2

Correction binoculaire

Open3D学习笔记一【初窥门径,文件读取】
随机推荐
jetson nano安装tensorflow踩坑记录(scipy1.4.1)
【Batch】learning notes
用全连接层替代掉卷积 -- RepMLP
Deep learning classification Optimization Practice
CONDA common commands
针对语义分割的真实世界的对抗样本攻击
Handwritten call, apply, bind
How do vision transformer work?【论文解读】
针对tqdm和print的顺序问题
Thesis tips
【Programming】
利用超球嵌入来增强对抗训练
Translation of the paper "written mathematical expression recognition with bidirectionally trained transformer"
【Sparse-to-Dense】《Sparse-to-Dense:Depth Prediction from Sparse Depth Samples and a Single Image》
Mmdetection installation problem
【TCDCN】《Facial landmark detection by deep multi-task learning》
Summary of solving the Jetson nano installation onnx error (error: failed building wheel for onnx)
【Sparse-to-Dense】《Sparse-to-Dense:Depth Prediction from Sparse Depth Samples and a Single Image》
AR系统总结收获
【Mixup】《Mixup:Beyond Empirical Risk Minimization》