通过使用经典ASP

时间:2016-04-16 06:40:30

标签: json asp-classic

我使用经典ASP和ASPJSON(http://www.aspjson.com/)尝试提取通过SendGrid API发送电子邮件时以JSON格式返回的数据。

这是一些示例JSON数据:

{  
   "message":"error",
   "errors":[  
      "some errors"
   ]
}

我可以通过以下方式访问“消息”部分的值:

Set oJSON = New aspJSON
oJSON.loadJSON(string_containing_json)

json_status = ap(oJSON.data("message"))

response.write(json_status)

但是,我无法访问“错误”部分的值,因为它的级别是一级。

是否有可能实现这一目标?

1 个答案:

答案 0 :(得分:0)

错误存储为Dictionary对象。你可以像这样枚举它们:

dim errors : set errors = oJSON.data("errors")
dim curError
for curError = 0 to errors.Count -1
  Response.Write( errors(curError))
  Response.Write( "<br />")
next
相关问题