我不能用aspjson写json模型

时间:2015-08-15 13:11:56

标签: json asp-classic

如何使用 aspjson

编写下面的json
[
  {
    "file_name": "xx",
    "user_name": "xxx",
    "action_date": "xxx",
    "action_text": "xxx",
    "user_profile_photo": "xxx"
  },
  {
    "file_name": "yyy",
    "user_name": "yyy",
    "action_date": "yyy",
    "action_text": "yyy",
    "user_profile_photo": "yyy"
  }
]

1 个答案:

答案 0 :(得分:2)

代码:

Dim oJSON : set oJSON = New aspJSON
oJSON.Data.Add 0, oJSON.Collection()
oJSON.Data(0).Add "file_name", "xxx"
oJSON.Data.Add 1, oJSON.Collection()
oJSON.Data(1).Add "file_name", "yyy"

Response.Write oJSON.JSONOutput()

输出:

[ { "file_name": "xxx" }, { "file_name": "yyy" } ]