Foxtable(狐表)用户栏目专家坐堂 → Json问题


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

主题:Json问题

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


加好友 发短信
等级:幼狐 帖子:198 积分:1655 威望:0 精华:0 注册:2013/1/11 15:10:00
Json问题  发帖心情 Post By:2016/12/12 19:41:00 [只看该作者]

{"status":"0","msg":"ok","result":{"number":"504759958290","type":"sfexpress","list":[{"time":"2016-12-11 02:42:10","status":"在官网\"运单资料&签收图\",可查看签收人信息"},{"time":"2016-12-10 08:39:23","status":"已签收(蔡钰怡 ),感谢使用顺丰,期待再次为您服务"},{"time":"2016-12-10 07:39:42","status":"正在派送途中,请您准备签收(派件人:黄国城,电话:18826042729)"},{"time":"2016-12-10 06:49:18","status":"快件到达 【中山东凤民乐村营业部】"},{"time":"2016-12-10 03:16:07","status":"快件在【中山三角集散中心】已装车,准备发往 【中山东凤民乐村营业部】"},{"time":"2016-12-10 00:33:45","status":"快件到达 【中山三角集散中心】"},{"time":"2016-12-09 22:20:52","status":"快件在【深圳黄田集散中心】已装车,准备发往 【中山三角集散中心】"},{"time":"2016-12-09 22:20:52","status":"快件到达 【深圳黄田集散中心】"},{"time":"2016-12-09 19:41:45","status":"快件在【深圳南山登良营业部】已装车,准备发往下一站"},{"time":"2016-12-09 18:47:42","status":"顺丰速运 已收取快件"}],"deliverystatus":"3","issign":"1"}}

Dim msc As Object, data1  As Object
Dim js_Code As String
js_Code = "function js(json) {eval(""var o=""+json);return o;}"
msc = CreateObject("MSScriptControl.ScriptControl")
With msc
    .Language = "Javascript"
    .Timeout = -1
    .AddCode(js_code)
data1 = .Run("js",json)
End With
output.show(data1.msg)
output.show(data1.result.number)
output.show(data1.result.type)
output.show(data1.result.deliverystatus)

For Each obj As object In data1.result.list
    output.Show(obj.time)
Next


list 部分要怎么取值,谢谢! 搞定了!~
[此贴子已经被作者于2016/12/12 19:45:58编辑过]

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


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2016/12/12 22:08:00 [只看该作者]

有问题吗?
我测试通过啊:

'...
Dim msc As Object, data1  As Object
Dim json As String = clipboard.gettext 'json数据赋值到剪贴版
Dim js_Code As String
js_Code = "function js(json) {eval(""var o=""+json);return o;}"
msc = CreateObject("MSScriptControl.ScriptControl")
With msc
    .Language = "Javascript"
    .Timeout = -1
    .AddCode(js_code)
data1 = .Run("js",json)
End With
output.show(data1.msg)
output.show(data1.result.number)
output.show(data1.result.type)
output.show(data1.result.deliverystatus)

For each obj as object in data1.result.list
    output.Show(obj.time)
    output.show(obj.status)
next


 回到顶部