I retrieve this data from the server this way : [{"password":"ok"}]
I would like to see only ok , not [{"password":" "}]
B4X:
Sub JobDone (Job As HttpJob)
If Job.Success Then
res = Job.GetString
Log("Back from Job:" & Job.JobName )
Log("Response from server: " & res)
Select Job.JobName
Case "controllo"
Label1.Text=res
Log(Job.GetString)
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
Dim parser As JSONParser
parser.Initialize(res)
End Sub
Use this tool to parse a JSON string and have the corresponding B4X code.
For string "[{"password":"ok"}]" it gives:
B4X:
Dim parser As JSONParser
parser.Initialize(<text>)
Dim root As List = parser.NextArray
For Each colroot As Map In root
Dim password As String = colroot.Get("password")
Next