以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  解析JSON求助  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=119447)

--  作者:bobolan521
--  发布时间:2018/5/25 8:58:00
--  解析JSON求助
你好,麻烦老师帮我看一下,我要获取以下的数据该怎么写代码?

{"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编辑过]

--  作者:有点甜
--  发布时间: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
--  发布时间:2018/5/25 9:48:00
--  
谢谢老师