当前位置:网站首页>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;
边栏推荐
- 高中数学必修一
- C # connect to MySQL database
- The hystrix dashboard reported an error hystrix Stream is not in the allowed list of proxy host names solution
- Sequence problem for tqdm and print
- CVPR19-Deep Stacked Hierarchical Multi-patch Network for Image Deblurring论文复现
- Remplacer l'auto - attention par MLP
- On the confrontation samples and their generation methods in deep learning
- Get the width and height of the screen in real time (adaptive)
- install.img制作方式
- OpenCV常用方法出处链接(持续更新)
猜你喜欢
Static library and dynamic library
It's great to save 10000 pictures of girls
Real world anti sample attack against semantic segmentation
Where do you find the materials for those articles that have read 10000?
Several methods of image enhancement and matlab code
Fundamentals of music theory (brief introduction)
A brief analysis of graph pooling
Open3d learning notes 1 [first glimpse, file reading]
Simply test the two different data transmission methods of content length and chunked
C language implements XML generation and parsing library (XML extension)
随机推荐
Carsim-路面3D形状文件参数介绍
VS Code配置问题
针对tqdm和print的顺序问题
MySQL optimization
Look for we media materials from four aspects to ensure your creative inspiration
The hystrix dashboard reported an error hystrix Stream is not in the allowed list of proxy host names solution
Principes fondamentaux de la théorie musicale (brève introduction)
Open3d learning notes II [file reading and writing]
Using super ball embedding to enhance confrontation training
Force deduction method summary: double pointer
Array and string processing, common status codes, differences between PHP and JS (JS)
Fundamentals of music theory (brief introduction)
The internal network of the server can be accessed, but the external network cannot be accessed
力扣每日一题刷题总结:链表篇(持续更新)
Global and Chinese market of snow sweepers 2022-2028: Research Report on technology, participants, trends, market size and share
Force deduction method summary: find classes
Replace convolution with full connection layer -- repmlp
Wang extracurricular words
C语言实现XML生成解析库(XML扩展)
Organigramme des activités