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 |
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
- IsError
- JSON.Format
- JSON.GetArrayItem
- JSON.GetArrayItemsAsList
- JSON.GetArrayItemsAsQuickList
- JSON.GetArrayPathItems
- JSON.GetArraySize
- JSON.Release
- QuickList.JoinJSON
- XML.ItemRefs
Release notes
- Version 14.4
- Changed JSON.GetArrayItemsAsList to return empty result if JSON is empty.
- Version 13.3
- Added JSON.GetArrayItemsAsQuickList and QuickList.JoinJSON functions.
- Version 10.4
- Added JSON.GetArrayItems function to work with huge JSON arrays.
- Version 8.3
- Fixed crash in JSON.GetArrayItemsAsList for undefined values.
- Version 8.1
- Added ReturnValues parameter for JSON.GetArrayItemsAsList function.
Blog Entries
This function checks for a license.
Created 22nd August 2020, last changed 22nd August 2020
