By default jQuery DataTables use the "aaData" property of the returned data which is an Array of Arrays with one entry for each column in the table.
Example
B4X:
Dim m As Map
m.Initialize
m.Put("aaData", GetContacts)
The GetContacts could be populated from a database by using the DBUtils class:
B4X:
Public Sub GetContacts As List
Dim l As List : l.Initialize
l = DBUtils.ExecuteMemoryTable(sqlObj, "SELECT * FROM CONTACTS ORDER BY Name ASC", Null, 0)
Return l
End Sub
The Map m can then be used to generate a JSON string which can be returned as a response to the server:
This will be used by the DataTable in the html file to load data from an external source by using parameter sAjaxSource in document get ready.
B4X:
Dim jg As JSONGenerator
jg.Initialize(m)
resp.ContentType = "application/json"
resp.Write(jg.ToString)
See also B4J HowTo > WebApps jQuery > jQuery UI DataTable