Android Question JSON String to B4XTable

David Hawkins

Active Member
Licensed User
Longtime User
Hi

I receive a json response from a database query and want to put the results into a B4XTable but I am having problems in achieving this, I have posted the code below. I have tried various things but without success.

B4X:
   If Job.Success Then
            Dim parser As JSONParser
            Dim response As String = Job.GetString
            parser.Initialize(response)
            Dim R As List = parser.NextArray

            Dim l As List
            l.Initialize

            For Each colroot As Map In R
                sDuration = colroot.Get("Duration")
                sRate = colroot.Get("Rate")
                sValue = colroot.Get("Value")
                sWorkType = colroot.Get("WorkType")
                sCompany = colroot.Get("Company")
                sWho = colroot.Get("Who")
                l.Addall(Array As String(sDuration, sRate, sValue, sWorkType, sCompany, sWho))
                Log(l)
            Next

            B4XTable1.SetData(l)
     End If
 
Top