Remove any JSONItem object previously created by calling the JSONCreate method.
Use JsonClearAll in order to free up memory resources.
WindowMain |
WindowLink |
YES |
NO |
Example XojoScript:
// Define upper limit
Dim numRecs As Integer = 3
// Create new JSON objects
Dim handleContent As Integer = JsonCreate
Dim handleRecipients As Integer = JsonCreate
Dim handleOneRecipient As Integer = JsonCreate
Dim id As String
JsonSetValue(handleContent,"message", "sms text")
JsonSetValue(handleContent,"sender", "NWS-SMS")
If handleContent >= 0 And handleRecipients >=0 And handleOneRecipient >=0 Then
For i As Integer = 0 To numRecs-1
// Add recipient
handleOneRecipient = JsonCreate
JsonSetValue(handleOneRecipient,"msisdn","4176210500"+Str(i))
// Add this new recipient to Array of recipients
JsonAppend(handleRecipients,handleOneRecipient)
Next
// Add whole recipients Array to Json Content object
JsonSetValueArray(handleContent,"recipients",handleRecipients)
// Convert JSON object to a string
Dim js As String = JsonToString(handleContent)
MsgBox(js)
// Release JSON Objects
JsonclearAll
End If