当前位置:网站首页>使用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;
边栏推荐
- 【学习笔记】Matlab自编图像卷积函数
- 【Batch】learning notes
- 【BiSeNet】《BiSeNet:Bilateral Segmentation Network for Real-time Semantic Segmentation》
- Open3d learning note 5 [rgbd fusion]
- Jetson nano installation tensorflow stepping pit record (scipy1.4.1)
- open3d学习笔记五【RGBD融合】
- How to turn on night mode on laptop
- Daily practice (19): print binary tree from top to bottom
- Eklavya -- infer the parameters of functions in binary files using neural network
- 【双目视觉】双目矫正
猜你喜欢
[learning notes] numerical differentiation of back error propagation
【Programming】
【Mixed Pooling】《Mixed Pooling for Convolutional Neural Networks》
Faster-ILOD、maskrcnn_ Benchmark training coco data set and problem summary
Deep learning classification Optimization Practice
【Mixup】《Mixup:Beyond Empirical Risk Minimization》
【TCDCN】《Facial landmark detection by deep multi-task learning》
【MobileNet V3】《Searching for MobileNetV3》
Jetson nano installation tensorflow stepping pit record (scipy1.4.1)
【MobileNet V3】《Searching for MobileNetV3》
随机推荐
[Sparse to Dense] Sparse to Dense: Depth Prediction from Sparse Depth samples and a Single Image
【Mixed Pooling】《Mixed Pooling for Convolutional Neural Networks》
Ppt skills
Machine learning theory learning: perceptron
【Paper Reading】
Replace convolution with full connection layer -- repmlp
Latex formula normal and italic
win10解决IE浏览器安装不上的问题
Eklavya -- infer the parameters of functions in binary files using neural network
[C # note] the data in DataGridView saved in WinForm is excel and CSV
Where do you find the materials for those articles that have read 10000?
Prompt 范式简述
[in depth learning series (8)]: principles of transform and actual combat
AR系统总结收获
【MnasNet】《MnasNet:Platform-Aware Neural Architecture Search for Mobile》
How to turn on night mode on laptop
EKLAVYA -- 利用神经网络推断二进制文件中函数的参数
open3d学习笔记三【采样与体素化】
open3d学习笔记四【表面重建】
将恶意软件嵌入到神经网络中