Foxtable(狐表)用户栏目专家坐堂 → 解析JSON求助


  共有2960人关注过本帖树形打印复制链接

主题:解析JSON求助

帅哥,在线噢!
bobolan521
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:637 积分:7362 威望:0 精华:1 注册:2013/11/26 7:49:00
解析JSON求助  发帖心情 Post By:2018/5/25 8:58:00 [只看该作者]

你好,麻烦老师帮我看一下,我要获取以下的数据该怎么写代码?

{"item-1527207237163":{"id":"item-1527207237163","locked":false,"placeholder":"","title":"明细","type":"list","un_print":false,"validate":false,"value":[{"item-1527207237163-0-0":{"id":"item-1527207336618","locked":false,"placeholder":"","title":"物料","type":"select","un_print":false,"validate":true,"value":"A4纸","setIndex":0,"listItem":true,"warning":""},"item-1527207237163-0-1":{"id":"item-1527207362796","locked":false,"placeholder":"","title":"数字","type":"number","un_print":false,"validate":true,"value":"2","listItem":true,"warning":""}},{"item-1527207237163-1-0":{"id":"item-1527207336618","locked":false,"placeholder":"","title":"物料","type":"select","un_print":false,"validate":true,"value":"硒鼓","setIndex":1,"listItem":true,"warning":""},"item-1527207237163-1-1":{"id":"item-1527207362796","locked":false,"placeholder":"","title":"数字","type":"number","un_print":false,"validate":true,"value":"1","listItem":true,"warning":""}}],"warning":""}}



物料    : A4纸  数字 :2
物料   :硒鼓   数字 :1

[此贴子已经被作者于2018/5/25 8:59:27编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/5/25 9:36:00 [只看该作者]

Dim json As String = ClipBoard.GetText
Dim jo As JObject = JObject.Parse(json)
output.show(jo.tostring)
Dim ja As JArray = jo("item-1527207237163")("value")
For i As Integer = 0 To ja.Count - 1
    Dim cjo As jobject = jobject.parse(ja(i).tostring)
    For Each ccjo As object In ja(i)
        msgbox(ja(i)(ccjo.name)("title").tostring)
        msgbox(ja(i)(ccjo.name)("value").tostring)
    Next
Next

 


 回到顶部
帅哥,在线噢!
bobolan521
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:三尾狐 帖子:637 积分:7362 威望:0 精华:1 注册:2013/11/26 7:49:00
  发帖心情 Post By:2018/5/25 9:48:00 [只看该作者]

谢谢老师

 回到顶部