所以我想要的是以下解析的json
相反,我收到Object doesn't support this property or method: 'Data'
错误
我确信错误不是从数据库获取数据,当我不尝试解析它时它工作正常。
PS:我在这里起诉asp extreme的插件。
{
"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
答案 0 :(得分:0)
你的意思是“插件”:Asp Extreme Evolution?
如果你看一下他们提供的例子,你应该使用
Record.setElement "..field..", "..value.."
此外,Set Record = JSON(...
和Set Record = Nothing
应分别在ObjCheckings循环之前和之后移动。
如果您使用其他内容,请告诉我们确切的插件。