JSON Handling in FileMaker 2024: New Features and Best Practises
4 Feb 2025
In 2024, Claris FileMaker introduced several exciting enhancements to JSON handling, offering developers more powerful and efficient ways to work with this ubiquitous data format. As specialists in custom Claris FileMaker solutions, we at iSOS have been utilising these new features in real-world solutions and we are happy to report on the improvements in developing using JSON in Claris FileMaker applications and provide some overall good practices.
New JSON Features in Claris FileMaker
JSONMakeArray Function
One of the most anticipated additions to Claris FileMaker’s JSON arsenal is the JSONMakeArray function. This powerful new tool simplifies the creation of JSON arrays from a list of values. The syntax for JSONMakeArray is:
JSONMakeArray ( listOfValues ; separator ; type )
This function streamlines the process of converting delimited lists into JSON arrays, a task that previously required more complex formatting by substituting characters, using While loops, creating Custom Functions or other calculation functions.
Enhanced JSONSetElement Functionality
Claris FileMaker has introduced two new operators to the JSONSetElement function which again makes it far easier to push elements onto an array and work with the last element in an array:
The [+] operator references a new, to-be-created element at the end of the array
The [:] operator references the last, already-existing element in the array
These operators significantly simplify array manipulation, allowing for more intuitive and readable code without having to manually record array indexes in calculations/scripts.
JSONSetElement( "[]";
[ "[+].id", 1, JSONNumber ] ;
[ "[:].name", "Jimmy", JSONString ] ;
[ "[+].id", 2, JSONNumber ] ;
[ "[:].name", "Sally", JSONString ]
)
Output:
[{"id":1,"name":"Jimmy"},{"id":2,"name":"Sally"}]
Improved JSONGetElement
The JSONGetElement function has also been enhanced to allow easier retrieval of the last value in a JSON array. This improvement similarly eliminates the need for complex workarounds that were previously necessary.
Using the new operator on the previous JSON example as follows:
JSONGetElement ( $NameListJSON ; "[:]" )
Will output:
{"id":2,"name":"Sally"}
Best Practices for JSON Handling in Claris FileMaker
Use the Data Viewer: When working with JSON, make extensive use of Claris FileMaker’s Data Viewer. It allows you to experiment with JSON functions and see immediate results, helping you grasp the nuances of JSON manipulation.
Start Small: Begin by creating simple JSON structures to represent basic data, like single records. Gradually move to more complex structures involving arrays and nested objects as you become more comfortable.
Leverage New Functions: Take full advantage of the new JSONMakeArray function and enhanced JSONSetElement functionality. These tools can significantly reduce the complexity of your scripts and improve performance.
Maintain Consistent Naming: When working with JSON, maintain consistent naming conventions between your Claris FileMaker fields and JSON keys. This practice can simplify your code and reduce errors when parsing JSON data.
Use JSONFormatElements for Debugging: The JSONFormatElements function can make your JSON data more readable during the development process. This is particularly useful when dealing with complex JSON structures.
Be Mindful of Case Sensitivity: Remember that JSON is case-sensitive, unlike Claris FileMaker variables. Pay close attention to the case when working with JSON keys and values.
Validate JSON Data: Before using JSON data in your scripts, validate it using functions like JSONFormatElements or JSONGetElementType to ensure it’s properly formatted.
Conclusion
The new JSON features available when using Claris FileMaker offer a significant improvement for developers. By leveraging these enhancements and following best practices, you can create more efficient, maintainable, and powerful Claris FileMaker solutions that effectively handle JSON data.
At iSOS, our team of 8 certified developers with over 93 years of combined experience is ready to help you harness the full potential of these new JSON capabilities in your custom Claris FileMaker solutions. Whether you’re integrating with web services, building complex data structures, or optimising your existing applications, we have the expertise to guide you through the process.
Latest Blog