Foxtable(狐表)用户栏目专家坐堂 → [讨论]读取Json 节点


  共有1670人关注过本帖平板打印复制链接

主题:[讨论]读取Json 节点

帅哥哟,离线,有人找我吗?
goodhawk
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:120 积分:1134 威望:0 精华:0 注册:2018/3/22 15:58:00
[讨论]读取Json 节点  发帖心情 Post By:2018/6/7 10:53:00 [只看该作者]

问题:我的json文件参照如下, 我的代码目的是为了读取 fileurl3, 目前用了遍历, 觉得有点复杂, 有什么方法能快速读取 fileurl3 的不? @有点甜

Json文件:
{
"code": "OK",
"msg": "上传成功",
"msgtype": "1",
"result": [{
"fieldName": "181606011604",
"fileurl1": "http://localhost:8081/simplefileserver//download?file=e64eebbc-88e7-4e79-a8e1-87a045ad029e",
"fileurl2": "http://localhost:8081/simplefileserver//userfiles/qundui//2018/6/7//e64eebbc-88e7-4e79-a8e1-87a045ad029e.jpg",
"fileurl3": "userfiles/qundui//2018/6/7/e64eebbc-88e7-4e79-a8e1-87a045ad029e.jpg"
}]
}


代码:
'Json 读取文件名
dim returnStr as string = ##Json串##
Dim jo As Jobject = Jobject.parse(returnStr)
For Each jt As JToken In jo("result")
   For Each a As object In jt
        If a.name = "fileurl3" Then 
            fileurl = a.value
        End If 
   Next
Next

MessageBox.Show("HI:" &  fileurl)

 回到顶部