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
204 stars 89 forks source link

Error on JSON.Serialize() #37

Closed marksamp closed 7 years ago

marksamp commented 7 years ago

Hi everybody. First thank you for this amazing code. It´s helping me a lot!

Anyway, i´m getting this weird error:

Microsoft VBScript runtime error '800a01b6' Object doesn't support this property or method: 'Obj.pairs' /sistema1/include/jsonObject.class.asp, line 632

When i´m running this code:

set rs = conn.execute("select * from avaliacao_estetica_fotos where id_avaliacao_estetica = '" & query("id_avaliacao_estetica") & "'")

if not rs.Eof then
    set JSON = New JSONobject

    while not rs.Eof 
        JSON.Add "url", rs("url")
        JSON.Add "thumbnailUrl", "../include/thumbnails.asp?path=../tela_atend/"& rs("url") & "&width=80"
        JSON.Add "name", rs("nome")
        JSON.Add "type", rs("type")
        JSON.Add "size", rs("size")
        JSON.Add "deleteUrl", "atendimento.asp?acao=apagar_foto_estetica&id_avaliacao_estetica_foto=" & rs("id_avaliacao_estetica_foto")
        JSON.Add "legend", rs("legend")
        JSON.Add "deleteType", "GET"
        rs.MoveNext
    wend

    Dim jsonString : jsonString = JSON.Serialize()

    wrt("{""files"":[" & jsonString & "]}")
    else
    wrt("")
end if

Am i doing something wrong?

Thanks in advance!

kentamurayama commented 7 years ago

@MarkSamp @rcdmk I was happened same error. But I can solve it.

I wrote follow code.

JSON.Add "To", RecordSet("to_email_adress")

I think it will set Json that key name is "To"(Type String) and value name is "XXX@gmail.com"(Type String).

But I confirm value parameter type. It is not String type. It is Field type object.

So, I rewrite own code to follow code.

JSON.Add "To", CStr(RecordSet("to_email_adress"))
rcdmk commented 7 years ago

Hi. Thank you for your report.

I've already done some adjustments about this issue some time ago and thought it was solved.

I will do something about this soon.