When I am using HttpUtils2, the JSON return from JobDone can be array or a simple text.
How can I check is it an array or simple text? Is there any function such as isArray ?
B4X:
Sub JobDone(Job As HttpJob)
Dim ret As String
Dim jsp As JSONParser
If Job.Success = True Then
ret = Job.GetString
jsp.Initialize(ret)
Select Case Job.JobName
Case "MyJob"
'ret = jsp.NextValue
Dim lst As List
lst = jsp.NextArray
For i = 0 To lst.Size - 1
Dim M As Map
M = lst.Get(i)
intID = M.Get("id")
Next
Case Else
Log("Missing Job=" & Job.JobName)
ToastMessageShow("Error: Invalid Job", True)
End Select
Else
Log("Error: (" & JobName & ") " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
How can I check is it an array or simple text? Is there any function such as isArray ?
B4X:
If isArray(jsp) = True Then
Dim lst As List
lst = jsp.NextArray
Else
strReturn = jsp.NextValue
End If