以文本方式查看主题

-  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=93989)

--  作者:dreamyuan
--  发布时间:2016/12/12 19:41:00
--  Json问题
{"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编辑过]

--  作者:狐狸爸爸
--  发布时间: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