• JSONWriter doesn't handle List of variant arrays

    By Mike Brown 1 decade ago
    The JSONWriter.ToJSON() method doesn't cater for a Notes List of variant arrays.  It assumes that the list members must either be scalar (i.e. single values) or Notes Objects.  If a list's members are actually variant arrays then the code will attempt to process them as Notes ojbects via the BuildNotesOjbectJSON method, which will come back empty-handed.
    
     
    
    Here&#39;s how to fix that. &nbsp;In the ToJSON() method, under the <strong>Elseif Islist(p_vInput) Then</strong> branch, look for the code below:</div>
    
    &nbsp;
    
    Forall e In p_vInput
    
    sReturn = sReturn &amp; Me.Key(Listtag(e))
    
    sReturn = sReturn &amp; Me.BuildNotesObjectJSON(e)
    
    End Forall
    
    &nbsp;
    
    Change that code to:
    
    Forall e In p_vInput
    
    sReturn = sReturn &amp; Me.Key(Listtag(e))
    
    &#39; MB 01/11/2013 - Need to cater for a list of variant arrays, so test for
    
    &#39; this. &nbsp;A straight test for typeName = &quot;STRING()&quot; doesn&#39;t work, even
    
    &#39; that&#39;s what the debugger shows sType&#39;s value to be. &nbsp;(If it&#39;s a single-value
    
    &#39; string then it would have been caught by the isScalar() test, further up.)
    
    If InStr(LCase(sType), &quot;string&quot;) &gt; 0 Then
    
    sReturn = sReturn &amp; me.AppendValue(e)
    
    Else
    
    sReturn = sReturn &amp; Me.BuildNotesObjectJSON(e)
    
    End If 
    
    End Forall
    
    • By Lars Berntrop 9 years ago

      Thanks! I'm integrating this into a new version!