Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 9.0   9.1   9.2   9.3   9.4   9.5   10.0   10.1   10.2   10.3    Statistic  


Queries records of current result set as JSON array.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
SQL 10.2 Yes Yes Yes Yes Yes
MBS( "SQL.GetRecordsAsJSON"; Command )   More


Parameter Description Example value
Command The command reference number gained with SQL.NewCommand. $Command


Returns JSON or error.


Queries records of current result set as JSON array.
Each array entry contains a record converted to JSON.

Dates, Intervals and BLOBs get converted to text. Boolean, Integer, Numeric and Double types are converted to numbers in JSON. Boolean is passed through as boolean. Null or unknown field types are returned as NULL in JSON.


Show record as JSON:

# Create select and run it
Set Variable [ $Command ; Value: MBS("SQL.NewCommand"; $Connection; "SELECT * FROM Test") ]
# Run it
Set Variable [ $result ; Value: MBS("SQL.Execute"; $Command) ]
If [ $result ≠ "OK" ]
    Show Custom Dialog [ "Error: " & $result ]
    Show Custom Dialog [ "JSON" ; MBS( "SQL.GetRecordsAsJSON"; $Command ) ]
End If
# Cleanup
Set Variable [ $result2 ; Value: MBS("SQL.FreeCommand"; $Command) ]

See also

Example Databases

Blog Entries

Release notes

Created 11st March 2020, last changed 11st March 2020

SQL.GetParamsAsJSON   -   SQL.GetRecordsAsText

Feedback: Report problem or ask question.

MBS Xojo tutorial videos