当前位置:网站首页>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;
边栏推荐
- MT4/MQ4L入门到精通EA教程第二课-MQL语言常用函数(二)-账户信息常用功能函数
- 中国SSD产业突围有多难?除了技术“瓶颈”还有哪里挑战?
- The security of the pension insurance?Reliable?
- The server quit without updating PID file (/usr/local/mysql/data/localhost.pid).
- composer的使用记录
- 力扣刷题记录4.1-----209. 长度最小的子数组
- 智能视频监控设计摄像头部分
- 2022中国眼博会,中国北京国际儿童青少年眼睛健康产业展览会
- Line segment tree of knowledge
- UsernameAuthenticationFilter授权成功后调用AuthenticationSuccessHandler时的解析
猜你喜欢
力扣刷题记录2.1-----27. 移除元素
数据库设计的总结
mysql 5.7 入坑
Summary of pytorch related knowledge points
33. 分别谈谈联合索引生效和失效的条件
The 7 taboos of time management summarized by the postgraduate students, how many have you won?
企业里Foxmail邮箱问题解决方法汇总
2022 PMP Project Management Certification Exam Registration Guide (1)
eladmin container deployment super detailed process
最新工业界推荐系统数据集-召回排序模型原理、结构及代码实战整理分享
随机推荐
MT4 / MQ4L entry to the master of EA tutorial lesson two (2) - - MQL language commonly used function account information commonly used functions
力扣刷题记录7.1-----707. 设计链表
Etcd realize large-scale application service management of actual combat
ROS 、SLAM 学习 error整理
MT4/MQL4入门到精通EA教程第一课-MQL语言常用函数(一)OrderSend()函数
Flume (四) --------- Flume 企业开发案例
Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules
17.flink Table Api基础概念讲解
2020.10.13开发日志
JDBC technology (3) - use Druid database connection pool test
[ANT]apache ant 安装说明
软件开发之我的一点想法
Simple example of .reduce()
在树莓派上使用cpolar(番外篇2)
New Swagger3.0 tutorial, OAS3 quick configuration guide, to automate API interface documentation!
JDBC技术(二)——设置通用的sql和配置文件
How js implements array deduplication (7 kinds)
2022杭电多校第五场1007(生成函数+启发式合并+ntt)
yii2的安装之路
智能视频监控设计摄像头部分