« The MBS Script Step | Home | Automate creation of … »

JSON Functions, MBS vs. FM16

Today I got the question what the difference is between our JSON functions in MBS Plugin and the ones in FileMaker 16. Well, the obvious ones are the fact that our plugin works down to FileMaker 7 on Windows (8.5 on Mac due to missing PPC support), so if you need it for older versions or runtimes, you go with the plugin. But if you use FileMaker 16, the built in functions are free for you and it’s hard to compete with free.

But maybe you want to take a second look on how long you may wait for bigger JSON data sets. We usually use XML and JSON import/export not for 3 records, but for thousands. We automate data exchange with other services and so we need to process 1000s of records. MBS Plugin functions are built for speed, so we prefer to use the JSON reference numbers. Parse the data once, get a number and query it often. The FileMaker functions do not keep the parsed data and do the parsing for each query. With MBS Plugin we can use reference numbers, so even for building large JSON data sets, you can avoid producing text for each step and parse it again to add the next value.

Finally you need to know that JSONGetElement always returns text. This may be fine first, but can get you in serious trouble later. For example if you take this formula:

GetAsNumber(JSONGetElement ( "[ 10, 20.5, 30]" ; 1 ))

The text returned is "20.5", but you need 20.5 as a numeric value. Because if you later want to process it, you may need a number. Now GetAsNumber will take the "20.5" and convert it to 20.5 on a typical US system. But with German localization, we actually get 205. The dot is ignored as the German functions require a comma as decimal separator. MBS Plugin provides values in the correct types like boolean, numbers and text. If you like, use FM.DataType function to check what type a value has.

FeatureMBS JSON FunctionsFileMaker’s JSON Functions
Number of functions596
Available in FileMaker VersionsFileMaker 7 to 16FileMaker 16 only
FileMaker Pro (Advanced)yesyes
Runtime Appsyesno
FileMaker Gonoyes
FileMaker iOS SDKyesyes
FileMaker Serveryesyes
Create arrays and objectsyesyes
Delete elementsyesyes
List Keysyesyes
Get/Set Valuesyesyes
Parse once, Query oftenyesno
JSON Import with field/table creationyesno
Return data typesboolean, number or textalways text
Create Array with 2000 entries162ms1792ms
Get Values from Array with 2000 entries195ms2364ms

Your time measurements will vary (and please deactivate Trace log), but in general not parsing and formatting JSON 2000 times in a loop saves a lot of time.
FileMaker's functions are great as a base and certainly help all the beginners getting started with JSON and REST services. If you need more speed or more features, feel free to test our MBS Plugin.
And if you miss something, let me know.

PS: Some of this issues with returning numbers have been improved in 16.0.2 release of FileMaker. Claris FileMaker Plugin
23 05 17 - 13:02