学习使用AX库来实现ASP

时间:2013-09-06 14:55:15

标签: json asp-classic

我正在尝试使用AX库来解析一些JSON数据。在尝试确保一切正常运行时,我创建了一个测试页面。我收到一个错误:

错误类型: Microsoft JScript编译(0x800A03EA) 语法错误 json2.asp第1行

我正在使用json2.asp文件中的代码来测试它:

<script language="javascript" runat="server" src="json2.asp"></script>
<%

dim TestData : set TestData = JSON.parse(join(array( _
    "{", _
    "  ""firstname"": ""Fabio"",", _
    "  ""lastname"": ""Nagao"",", _
    "  ""alive"": true,", _
    "  ""age"": 27,", _
    "  ""nickname"": ""nagaozen"",", _
    "  ""fruits"": [", _
    "    ""banana"",", _
    "    ""orange"",", _
    "    ""apple"",", _
    "    ""papaya"",", _
    "    ""pineapple""", _
    "  ],", _
    "  ""complex"": {", _
    "    ""real"": 1,", _
    "    ""imaginary"": 2", _
    "  }", _
    "}" _
)))

Response.write(TestData.firstname & vbNewline) ' prints Fabio
Response.write(TestData.alive & vbNewline) ' prints True
Response.write(TestData.age & vbNewline) ' prints 27
Response.write(TestData.fruits.get(0) & vbNewline) ' prints banana
Response.write(TestData.fruits.get(1) & vbNewline) ' prints orange
Response.write(TestData.complex.real & vbNewline) ' prints 1
Response.write(TestData.complex.imaginary & vbNewline) ' prints 2

' You can also enumerate object properties ...

dim key : for each key in TestData.keys()
    Response.write( key & vbNewline )
next

set TestData = nothing

我哪里错了?

0 个答案:

没有答案