我正在尝试使用 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
我哪里错了?