JSON - 解析多个级别

时间:2016-08-30 17:10:03

标签: json asp-classic

我是JSON的新手,并尝试解析多个级别,但卡住了。我正在使用名为" json2.asp"的包含文件。 (链接如下),它基于json2.js。

https://github.com/nagaozen/asp-xtreme-evolution/blob/master/lib/axe/classes/Parsers/json2.asp

所以,到目前为止,我已经使用下面的代码了解了这一点。

Set jsonObj = JSON.parse("{}")
jsonObj.set "Subject", "Testing Event Creation" 
jsonObj.set "Start", "2016-08-30T15:00:00-07:00" 
jsonObj.set "StartTimeZone", "Pacific Standard Time" 
jsonObj.set "End", "2016-08-30T17:00:00-07:00" 
jsonObj.set "StartTimeZone", "Pacific Standard Time"
jsonObj.set "Attendees", array(JSON.parse("{""EmailAddress"": {""Address"":""user1@domain.com"", ""Name"": ""User""},""Type"":""Required""}" ))

上面的代码产生以下输出:

{
  "Subject": "Testing ERP Event 2",
  "Start": "2016-08-30T15:00:00-07:00",
  "StartTimeZone": "Pacific Standard Time",
  "End": "2016-08-30T17:00:00-07:00",
  "Attendees": [
    {
      "EmailAddress": {
        "Address": "user1@domain.com",
        "Name": "User"
      },
      "Type": "Required"
    }
  ]
}

现在,我不得不在" Attendees"下添加额外的电子邮件地址。如下例所示:

{
  "Subject": "Testing ERP Event 2",
  "Start": "2016-08-30T15:00:00-07:00",
  "StartTimeZone": "Pacific Standard Time",
  "End": "2016-08-30T17:00:00-07:00",
  "Attendees": [
    {
      "EmailAddress": {
        "Address": "user1@domain.com",
        "Name": "User1"
      },
      "Type": "Required"      
    },
    {
      "EmailAddress": {
        "Address": "user2@domain.com",
        "Name": "User2"
      },
      "Type": "Optional"      
    },
    {
      "EmailAddress": {
        "Address": "user3@domain.com",
        "Name": "User3"
      },
      "Type": "Required"      
    }
  ]
}

我知道我没有正确地这样做。请告诉我使用json2.asp执行多个级别的有效方法。我试图设置"参加者"作为一个单独的对象,所以我可以添加电子邮件地址,但没有成功。

提前致谢。

0 个答案:

没有答案