Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JSON.GetArraySize
Queries the number of array entries.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 2.7 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
json | A JSON text or reference. | "[1,2,3]" |
Result
Returns number of array entries.
Description
Queries the number of array entries.Examples
Checks number of array elements:
MBS( "JSON.GetArraySize"; "[1, 2, 3, 4]" )
Filter items in JSON:
Let([
// input may come from caller
input = "[{\"land\": \"CH\"}, {\"land\": \"CH\"}, {\"land\": \"DE\"}, {\"land\": \"AT\"}, {\"land\": \"CH\"}, {\"land\": \"CH\"}]";
// parse the JSON
j = MBS("JSON.Parse"; input);
// loop over items backwards
c = MBS("JSON.GetArraySize"; j);
r = While ( [ i = c-1 ] ; i >= 0 ; [
// query a value and if it doesn't match
r = If( MBS( "JSON.GetPathItem"; j; i & ¶ & "land"; 1 ) <> "CH" ;
// remove an item
MBS( "JSON.DeleteItemFromArray"; j; i ); ""); i = i - 1 ] ; "" );
// Format and return JSON
r = MBS("JSON.Format"; j);
x = MBS("JSON.Release"; j)
]; r)
See also
- FM.SQL.JSONRecords
- JSON.DeleteItemFromArray
- JSON.Format
- JSON.GetArrayItem
- JSON.GetArrayItems
- JSON.GetPathItem
- JSON.Parse
- JSON.Release
Release notes
- Version 14.3
- Fixed JSON.GetArraySize to return no error for empty JSON and just return zero.
Example Databases
- Barcode/Barcodes from Invoices
- CURL/Email/IMAP Email List
- CURL/Email/IMAP Email
- CURL/MQTT
- JSON/JSON Order Parsing
- Mac and iOS/Data Detector
- Mac and iOS/Machine Learning/Core Image Detection
- Mac and iOS/MapKit/MapView BeeExample
- Mac only/ImageCapture/Camera Import
- Win Only/WindowsML
Blog Entries
- MQTT in FileMaker
- MBS FileMaker Plugin, version 14.3pr2
- MBS Plugin Advent calendar: 20 - MapView
- With JSON in excellent form
- Sum up values in JSON with MBS FileMaker Plugin
- Comparing Base Elements Plugin to MBS FileMaker Plugin
- Face detection via CoreImage in FileMaker
FileMaker Magazin
This function is free to use.
Created 18th August 2014, last changed 5th November 2020