• Stringifyjsonobject

    By Trond Hegerstroem 1 decade ago

    Hello,



    The method stringifyjsonobject does not work properly.



    I made the private variable mItemList in class JSONObject public, an rem'ed the getter:



    Class JSONObject

    'private mItemList List As Variant<br/>
    Public mItemList List As Variant<br/>
    <br/>
    Sub New()<br/>
    End Sub<br/>
    <br/>
    '*********************** PUBLIC PROPERTIES ********************<br/>
    'Public Property Get ItemList As Variant<br/>
    '   ItemList = Me.mItemList<br/>
    'End Property<br/>
    <br/>
    '*********************** PUBLIC METHODS *********************** <br/>
    <br/>
    Public Sub AddItem(pItemName As String, pItemVal As Variant)<br/>
    .......<br/>
    



    and changed the forall loop in function stringifyjsonobject in class JSON:


    Private Function stringifyJSONObject(pSourceVal As Variant) As String<br/>
        Dim returnStr As String<br/>
        Dim itemStr As String<br/>
        <br/>
        '// Step through the array and build the string<br/>
        returnStr = &quot;&quot;    <br/>
                        <br/>
        Forall x In pSourceVal.mItemList<br/>
            itemStr = &quot;&quot;&quot;&quot; &amp; Listtag(x) &amp; &quot;&quot;&quot;&quot; &amp; &quot;:&quot; &amp; stringifyVariant(x) <br/>
            If returnStr = &quot;&quot; Then<br/>
    .......<br/>
    



    Stringify works….



    Regards…