Loading

JSON looped data - FAILS

  1. <%@ LANGUAGE=VBScript %>
  2. <!--#INCLUDE FILE="aspJSON1.16.asp"-->
  3. <%
  4.  
  5. ' Set the page content headers
  6. Response.ContentType = "application/json"
  7. Response.Charset = "UTF-8"
  8.  
  9. ' Set the default response
  10. Set oJSONResponse = New aspJSON
  11. oJSONResponse.data("result") = "OK"
  12. oJSONResponse.data("details") = "JSON data parsed successfully"
  13. oJSONResponse.data("action") = "wtf"
  14.  
  15. ' Create the fieldPoints collection
  16. Set oJSONResponse.data("fieldPoints") = oJSONResponse.Collection()
  17.  
  18. ' Start the loop
  19. x = 1
  20. Do Until x = 5000
  21.  
  22. '    Response.Write """fieldName"", ""field name here (x="&x&")""" & VbCrLf
  23. '    Response.Write """fieldID"", ""field id here (x="&x&")""" & VbCrLf
  24. '    Response.Write """fieldArea"", ""field area here (x="&x&")""" & VbCrLf
  25. '    Response.Write """lat"", ""lat here (x="&x&")""" & VbCrLf
  26. '    Response.Write """long"", ""long here (x="&x&")""" & VbCrLf
  27. '    Response.Write VbCrLf
  28.  
  29.     Set newitem = oJSONResponse.AddToCollection(oJSONResponse.data("fieldPoints"))
  30.     newitem.add "fieldName", "field name here (x="&x&")"
  31.     newitem.add "fieldID", "field id here (x="&x&")"
  32.     newitem.add "fieldArea", "field area here (x="&x&")"
  33.     newitem.add "lat", "lat here (x="&x&")"
  34.     newitem.add "long", "long here (x="&x&")"
  35.  
  36.     x = x + 1
  37. Loop
  38.  
  39. ' Write the response
  40. Response.Write oJSONResponse.JSONoutput()
  41.  
  42. ' Clean up
  43. Set oJSONResponse = nothing
  44.  
  45. %>

Version history

Revision # Author Created at
ppqyzrgcd Rich 27 Feb 2014, 15:50:46 UTC Diff
puncszuys Rich 27 Feb 2014, 15:45:50 UTC Diff
pcjd5pmzg Rich 27 Feb 2014, 15:44:45 UTC Diff
pjkazukuf Rich 27 Feb 2014, 15:44:03 UTC Diff

Comments

Ignore the version history...

Rich • 27 Feb 2014, 16:10:56 UTC