Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5    Statistic  

FM.SQL.JSONRecords

Returns rows as JSON array.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
FM FMSQL JSON 8.1 Yes Yes Yes Yes Yes

MBS( "FM.SQL.JSONRecords"; SQLref; FieldNames { ; Flags } )

Parameters

Parameter Description Example value
SQLref The reference number returned by FM.SQL.Execute function. $SQLRef
FieldNames A list of field names for the JSON. "Model¶Names"
Flags Optional
The flags for the json creation.
Pass 1 to get all values as text.
Pass 2 to get all dates, times and timestamps in SQL format.
1+2

Result

Returns JSON text or error.

Description

Returns rows as JSON array.
You provide list of field names, which should be in same order as fields in SQL result.
Optionally we can return SQL dates, times and timestamps as SQL format.
Containers are returned as Base64 encoded data.

Examples

Query JSON:

Set Variable [ $sql ; Value: MBS( "FM.SQL.Execute"; ""; "SELECT \"First\", \"Last\", Birthday, \"Photo Container\" FROM Contacts") ]
Set Variable [ $json ; Value: MBS( "FM.SQL.JSONRecords"; $sql; "First¶Last¶Birthday¶Photo"; 2) ]
Show Custom Dialog [ "JSON" ; $json ]
Set Variable [ $r ; Value: MBS( "FM.SQL.Release"; $sql ) ]

See also

Created 4th March 2018, last changed 21st March 2018


FM.SQL.JSONRecord   -   FM.SQL.Release

Feedback: Report problem or ask question.




Links
MBS FileMaker blog