所以我想要的是以下解析的 json。
相反,我得到 Object doesn't support this property or method: 'Data'
了错误。
我确信错误不在于从数据库中获取数据,当我不尝试解析它时它工作正常。
PS:我在这里起诉aspextreme的插件。
{
"checkins": {
"data": [
{
"strFirstName": "james",
"strDateEntered": "2013-03-01 15:13:49"
},
{
"strFirstName": "john",
"strDateEntered": "2013-03-05 15:13:49"
}
]
}
}
代码:
Set Dataset = JSON.parse("{}")
Dataset.set "checkins", JSON.parse("{ ""data"": [] }")
SQL = "SELECT C.CheckinID, C.MemberID, C.VENUENAME, C.VenueLat, C.VenueLng, C.VENUECREATEDAT, C.CheckInDateEntered"
SQL = SQL & " FROM CHECKINS C"
SQL = SQL & " ORDER BY VENUECREATEDAT DESC"
Set objCheckins = objConn.Execute(SQL)
If NOT objCheckins.EOF Then
Do While NOT objCheckins.EOF
SQL = "SELECT FirstName, LastName"
SQL = SQL & " FROM MEMBERS"
Set objMember = objConn.Execute(SQL)
Set Record = JSON.parse("{}")
Record.set "strFirstName", ""& objMember("FirstName") & ""
Record.set "strDateEntered", ""& objCheckins("VENUECREATEDAT") & ""
Dataset.data.push(Record)
Set Record = nothing
Data = JSON.stringify(Dataset, null, 2)
objCheckins.Movenext
Loop
End If
objCheckins.Close
Set objCheckins = Nothing
Response.Write Data