Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

JSON.GetArrayItems

Queries entries from JSON array.

Component Version macOS Windows Linux Server iOS SDK
JSON 10.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "JSON.GetArrayItems"; json )   More

Parameters

Parameter Description Example
json A JSON text or reference. "[1,2,3]"

Result

Returns list or error.

Description

Queries entries from JSON array.
Returns list of reference numbers for JSON objects.
Performance is better than FileMaker native once array is big enough.

Examples

Loop over JSON array items:

# get some huge JSON array
Set Variable [ $json ; Value: "[\"Hello\", \"World\"]" ]
# Create list of JSON reference numbers
Set Variable [ $list ; Value: MBS( "JSON.GetArrayItems"; $json ) ]
If [ MBS("IsError") = 0 ]
    # loop over list
    Set Variable [ $count ; Value: ValueCount($list) ]
    If [ $count > 0 ]
        Set Variable [ $index ; Value: 1 ]
        If [ $index$count ]
            Loop
                # your script steps here
                Set Variable [ $j ; Value: GetValue($list; $index) ]
                Show Custom Dialog [ "JSON item" ; MBS("JSON.Format"; $j) ]
                #
                # next
                Set Variable [ $index ; Value: $index + 1 ]
                Exit Loop If [ $index > $count ]
            End Loop
        End If
    End If
    # free them all
    Set Variable [ $r ; Value: MBS("JSON.Release"; $list) ]
End If

See also

Release notes

Blog Entries

This function checks for a license.

Created 22nd August 2020, last changed 22nd August 2020


JSON.GetArrayItem - JSON.GetArrayItemsAsList