rcdmk / aspJSON

A fast classic ASP JSON parser and encoder for easy JSON manipulation to work with the new JavaScript MV* libraries and frameworks.
MIT License
203 stars 89 forks source link

change "data" for what you want #4

Closed dtrillo closed 8 years ago

dtrillo commented 8 years ago

I've studied your code, and I wonder if you could add new methods and properties in order to give the chance to the user to assign the name of the property "data". You always can have "data" as "default".

' Load properties from a ADO RecordSet object public sub LoadRecordSet(byref rs) LoadRecordSet2 rs, "data" end sub

' Load properties from a ADO RecordSet object
public sub LoadRecordSet2(byref rs, prop)
    dim arr, obj, field

    set arr = new JSONArray 

    while not rs.eof
        set obj = new JSONobject

        for each field in rs.fields
            obj.Add field.name, field.value
        next

        arr.Push obj

        rs.movenext
    wend

    set obj = nothing

    add prop, arr
end sub
rcdmk commented 8 years ago

Nice idea! I'll take this in the next release.