2013-03-14 67 views
1

所以我想要的是以下解析的json。
相反,我得到了Object doesn't support this property or method: 'Data'的錯誤。
我確定該錯誤不是從數據庫中獲取數據,而是在我不嘗試解析數據時正常工作。
PS:我在這裏起訴asp extreme的插件。json使用數組解析asp Xtreme

{ 
     "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

你的意思是這個 「插件」:Asp Extreme Evolution

如果你看看他們給出的例子,你應該使用

Record.setElement "..field..", "..value.." 

此外,Set Record = JSON(...Set Record = Nothing應前,分別被移動和ObjCheckings循環之後。

如果您使用其他方式,請讓我們知道確切的插件。