moodyjim / aspjson

Automatically exported from code.google.com/p/aspjson
0 stars 0 forks source link

jsObject() breaks at 10 #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
var user = 20
ReDim member(users)
For usr = 0 to users
  Set member(usr) = jsObject()
  member(usr)("id") = usr
  member(usr)("num_a") = usr
  member(usr)("num_b") = usr
  member(usr)("num_c") = usr
  member(usr)("num_d") = usr
Next
response.write toJSON(member)

The code is a sample only, however it works fine but it breaks at usr = 10,
seem ths jsObject() can't handle numbers above 9

Original issue reported on code.google.com by saichholzer@gmail.com on 9 Apr 2009 at 9:09

GoogleCodeExporter commented 9 years ago
Yes, this seems to fix the issue:
line 144:
    'If i <> 1 Then sPB2 = sPB2 & ","

Original comment by saichholzer@gmail.com on 9 Apr 2009 at 9:30

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
A Proposed fix for Function MultiArray to handle array dimensions > 9

Function MultiArray(aBD, iBC, sPS, ByRef sPT)   ' Array BoDy, Integer BaseCount, 
String PoSition
    Dim iDU, iDL, i, er ' Integer DimensionUBound, Integer DimensionLBound
    On Error Resume Next
    iDL = LBound(aBD, iBC)
    iDU = UBound(aBD, iBC)
    er = Err.Number
    On Error Goto 0 

    Dim sPB ' String PointBuffer1, String PointBuffer2
    If er = 9 Then
        If UBound(sPT)=-1 Then sPB = sPS Else sPB=Join(sPT,",") & "," & sPS
        MultiArray = MultiArray & toJSON(Eval("aBD(" & sPB & ")"))
    Else
        If VarType(sPT)<>8204 Then sPT=Array()
        If sPS<>"" Then 
            ReDim Preserve sPT(UBound(sPT)+1)
            sPT(UBound(sPT)) = sPS
        End If 
        MultiArray = MultiArray & "["
        For i = iDL To iDU
            MultiArray = MultiArray & MultiArray(aBD, iBC + 1, i, sPT)
            If i < iDU Then MultiArray = MultiArray & ","
        Next
        MultiArray = MultiArray & "]"
        If UBound(sPT)>0 Then ReDim Preserve sPT(UBound(sPT)-1) Else 
sPT=Array()
    End If
End Function

Original comment by mark.pal...@gmail.com on 2 Jul 2009 at 9:35

GoogleCodeExporter commented 9 years ago

Original comment by tugrulto...@gmail.com on 8 Nov 2009 at 7:12

GoogleCodeExporter commented 9 years ago

Original comment by tugrulto...@gmail.com on 9 Nov 2009 at 11:04