• JSonRead display INITIALIZE:ERROR 152. I'm doing something wrong?

    By Alejandro Ramirez 1 decade ago

    Hi, Great LS clases! JsonWrite works like a charm! thank you! but I'm having some problems to test the JSonRead. I'm sure I'm doing something incorrecly.



    My test agent have the following code:



    Use "ls.snapps.JSONReader"



    Dim sJSON As String

    Dim jsonReader As JSONReader

    Dim vResults As Variant

    Dim vPieces As Variant

    Set jsonReader = New JSONReader

    sJSON = | {"346ADA1CFE716F79862575EF0059EC8C":{"Authors":["CN=mike wasauski\/OU=Green\/O=Ball=US"],"Attachments":0,"AttachmentNames":[""],"AttachmentLengths":[""],"AttachmentModifiedTimes":[""],"Created":"2009/07/10 11:22:12 UTC-0500","HttpURL":"http:\/\/W2003Lotus\/862573C9005DF301.nsf\/0\/346ADA1CFE716F79862575EF0059EC8C?OpenDocument","IsResponse":false,"LastAccessed":"2009/07/10 11:22:18 UTC-0500","LastModified":"2009/07/10 11:22:18 UTC-0500","NoteID":"8FE","NotesURL":"notes:\/\/W2003Lotus@Dev\/862573C9005DF301.nsf\/0\/346ADA1CFE716F79862575EF0059EC8C?OpenDocument","ParentDocumentUNID":"","UniversalID":"346ADA1CFE716F79862575EF0059EC8C","Items":{"form":{"Values":["Test"],"Type":"TEXT"},"field1":{"Values":["data1"],"Type":"TEXT"},"field2":{"Values":["data2"],"Type":"TEXT"},"field3":{"Values":["data3"],"Type":"TEXT"},"$updatedby":{"Values":["mike wasauski\/OU=Green\/O=Ball=US"],"Type":"NAMES"}}}}|

    vResults = jsonReader.Parse(sJSON) 'this is a JSONObject

    vPieces = vResults.Items

    Msgbox "break for LS debug" ' ignore this line. Just a msg for breakpoint



    btw, sJSON= |…| is a single line.



    The error I receive is:



    INITIALIZE ERROR 152: {type mismatch no external name: JSONOBJECT} at line 121. Current character = ""; Previous Character = ""; Remaining string= "'346ADA1CFE716F79862575EF0059EC8C …



    Thank you very much for your help!



    -Alex

    • Re: JSONObject

      By Troy Reimer 1 decade ago

      I believe that the JSONReader has lost its pointers to the JSONObject library. You should recompile the LotusScript code or at the very least open the ls.snapps.JSONReader library and resave it.



      Also, I think you will need to add a "Set" to the following line:

      SET vResults = jsonReader.Parse(sJSON) 'this is a JSONObject