当前位置:网站首页>Json之JArray的使用方法
Json之JArray的使用方法
2022-08-09 02:21:00 【yutiedun】
从接口获取到的Json字符串
[{"filesize":"183556","fileext":"jpg","filename":"\u591c\u665a\u7684\u5927\u697c","filepath":"\/userfiles\/spaceshow\/20190530\/ee85ddaea8b045934ddd074b9ba949cd.jpg"},{"filesize":"51529","fileext":"jpg","filename":"\u5f69\u8272\u7684\u676f\u5b50","filepath":"\/userfiles\/spaceshow\/20190530\/eba5980ecf41c79b52c073b545155d94.jpg"},{"filesize":"112540","fileext":"jpg","filename":"\u4eba\u95f4\u4e0d\u503c\u5f97","filepath":"\/userfiles\/spaceshow\/20190530\/199c1726268b1dfbc2750b6efcfa764a.jpg"}]
C#解析到数组
var file_objs = new JArray() ;
try
{
file_objs = JArray.Parse(spaceobj.file_json);
}
catch (Exception ex)
{
MessageBox.Show("解析失败," + ex.Message);
return;
}
string zhanshitype = "others";
int akey = 0;
spaceobj.swfpatharr = new string[file_objs.Count];
foreach (JToken onefile in file_objs)
{
string filepath = onefile["filepath"].ToString();
string fileext = onefile["fileext"].ToString();
spaceobj.swfpatharr[akey] = userobj.xdomain + filepath;
if (config.lookaspicture.IndexOf("'" + fileext + "'") >= 0)
{
zhanshitype = "picture";
}
else if (config.lookassound.IndexOf("'" + fileext + "'") >= 0 || config.lookasvideo.IndexOf("'" + fileext + "'") >= 0)
{
zhanshitype = "video";
}
akey++;
}
spaceobj.totalpage = spaceobj.swfpatharr.Length;
边栏推荐
- The 7 taboos of time management summarized by the postgraduate students, how many have you won?
- MT4/MQL4 entry to proficient foreign exchange EA tutorial Lesson 1 Getting to know MetaEditor
- Summary of pytorch related knowledge points
- eladmin容器部署超详细过程
- JDBC技术(三)——使用Druid数据库连接池测试
- Maya engine modeling
- 【Unity】判断鼠标是否点击在UI上
- New Swagger3.0 tutorial, OAS3 quick configuration guide, to automate API interface documentation!
- 2022 Eye Health Brand Franchise Exhibition, Beijing Vision Care Exhibition, China Ophthalmology Technology Summit
- Electromagnetic radiation safety standards and detection methods
猜你喜欢
随机推荐
Mysql 5.7 into the pit
嵌入式设备驱动开发
数据恢复软件EasyRecovery支持恢复所有类型的文件
Latex示例参考
JDBC technology (2) - set up common sql and configuration files
How SEMRush finds keywords for advertising
SEMRush如何寻找关键词用于投放广告
33. 分别谈谈联合索引生效和失效的条件
Go-7-RESTful API的设计
MT4/MQL4入门到精通EA课程第二课-常用的功能函数
MT4/MQL4入门到精通外汇EA教程第一课 认识MetaEditor
Likou Brush Question Record--Common Functions
力扣刷题记录6.1-----203. 移除链表元素
Using ngrok on Raspberry Pi (Extra 2)
MT4/MQL4入门到精通EA教程第一课-MQL语言常用函数(一)OrderSend()函数
D. Tournament Countdown
Simple example of .reduce()
Go-12-结构体
MT4/MQ4L入门到精通EA教程第二课-MQL语言常用函数(二)-账户信息常用功能函数
The most fierce "employee" in history, madly complaining about the billionaire boss Xiao Zha: So rich, he always wears the same clothes!