aspjson
aspjson copied to clipboard
Seemd slow
This seems very slow - is there anything I can do to speed it up as there are an awful lot of records to process The page speed is ok until this bit - thanks
Set oJSON = New aspJSON
With oJSON.data
For i=0 To Ubound(ShiftsId)
.Add i, oJSON.Collection()
With .item(i)
.Add "start", ShiftsDate(i) + "T" + ShiftsStartHours(i)
.Add "end", ShiftsDate(i) + "T" + ShiftsEndHours(i)
.Add "title", ShiftsTitle(i)
.Add "resource", ShiftsId(i)
.Add "slot", ShiftsSlot(i)
.Add "shifttype", ShiftsType(i)
.Add "shiftsdatefrom", ShiftsDateFrom(i)
.Add "shiftsdateto", ShiftsDateTo(i)
.Add "shiftsdbid", ShiftsDbID(i)
End With
Next
End With
Other way to use with asp classic JSON is to use with Microsoft SQL JSON function. I think it's faster!
use this:
sqlj = "select * from openjson(N'" & JSON& "');" set rsj = connection.execute(sqlj) ' you need to create a connection with SQL do while not rsj.eof select case rsj("key") case "parameter1" parameter1= rsj("value") case "parameter2" parameter2= rsj("value") case "parameter3" parameter3= rsj("value") case "parameter4" ' IF HAS SUB PARAMETERS sqlj2 = "select * from openjson(N'" & rsj("value") & "');" Set rsj2 = connetion.execute(sqlj2) Do While Not rsj2.eof Select Case rsj2("key") Case "subparameter1" subparameter1= rsj2("value") End select rsj2.movenext Loop Set rsj2 = Nothing end select rsj.movenext loop set rsj = nothing