以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- json字符串如何解析出里面的字段? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=99104) |
-- 作者:ycwk -- 发布时间:2017/4/12 18:52:00 -- json字符串如何解析出里面的字段? 用 Dim ret As String = hc.GetData()通过webservice对方给我返回这么一个json字符串,请问怎么解析出里面的各个字段? <?xml version="1.0" encoding="utf-8"?> <string xmlns="http://tempuri.org/">[{"acct_year":"2017","acct_month":"01","emp_code":"000049","emp_name":"张三","dept_code":"440001","dept_name":"销售部","人员类别":"在编","岗位工资":1390.0000,"薪级工资":619.0000,"补发":0.0000}]</string> \' 解析ret Dim json As String = ret Dim jo As JObject=Jobject.parse(json) 用 jo("acct_year") 貌似不行啊
|
-- 作者:有点色 -- 发布时间:2017/4/12 19:34:00 -- Dim str As String = FileSys.ReadAllText("d:\\test.txt", encoding.default) Dim xmlDoc As New System.XML.XmlDocument xmlDoc.Loadxml(str) Dim ndList = xmlDoc.GetElementsByTagName("string") Dim json = ndList(0).innerText Dim jo As JArray=JArray.parse(json) msgbox(jo(0)("acct_year") ) |