When you call .toJSON on an empty JSONArray, it throws the following error:
"Error: '13',' ERROR: 13: Type mismatch."
Resolved this by adding a count check around the forall in JSONArray.toJSON
Original:
>Forall i In Me.m_vData
> sType = Typename(i)
> If sType = "JSONOBJECT" Or sType = "JSONARRAY" Then
> sReturn = sReturn & jsonWriter.AppendJSON(i.ToJSON)
> Else
> sReturn = sReturn & jsonWriter.AppendValue(i)
> End If
>End ForAll
Updated:
>If me.Count>0 then
> Forall i In Me.m_vData
> sType = Typename(i)
> If sType = "JSONOBJECT" Or sType = "JSONARRAY" Then
> sReturn = sReturn & jsonWriter.AppendJSON(i.ToJSON)
> Else
> sReturn = sReturn & jsonWriter.AppendValue(i)
> End If
> End ForAll
>End if