Why Use JSON with FileMaker?
- It's a lightweight data-interchange format (data exchange between different programs)
- JSON is self-describing - meaning it's relatively easy to understand the relationship between the data in the JSON structure
- JSON is computer language independent, meaning any programming language can read and use it.
What it really comes down to is this: Most web services support data exchange (usually download for our use, but not always) using JSON, which means that data is available to us as FileMaker programmers and users from virtually any web service out there. And even though it is a text only tool, it supports numbers, arrays, and boolean values, strings, JSON objects, and NULL values.
FileMaker 16 and JSON
FileMaker 16 added a suite of JSON tools to it's function set, making it easy to handle JSON:
- Easily parse JSON files into our apps
- Easily format our data into JSON format for the return journey or to share with others
Since the release of FileMaker 16, there has been an explosion of tools from the FileMaker community, making it even easier to use.
Here are just a few examples:
The free downloadable FileMaker example file at the link, (actually, there are two files: the example file and a link to a JSON additions file). These files make it easy to generate charts from JSON data. There's also a video at the link to get you up to speed a little faster.
Don't forget Generator
Geist Interactive released Generator, a free FileMaker Example File, last summer. Generator does more than just parse JSON. It helps you to more easily connect to almost any web service via the services's API (Application Programming Interface) and writes the code to copy into your app for you. That's a heck of a deal.
Andy Persons and Doug West, both from Excelisys, just released a JSON viewer/editor FileMaker helper file (and it's free, of course). Their file helps you easily drill down into and manipulate JSON files and more:
- When JSON text is initially entered, the “JSON — Create Children” script retrieves the root keys using JSONListKeys(), loops through the result, and creates the root records.
- When an element is eXpanded, the same script creates its child records if they don’t eXist and eXpands the hierarchy.
- When eXpand All is clicked, a similar script “JSON — Create All Descendants” loops through every element recursively and creates all descendants.
- Values for each record are retrieved and set using JSONGetElement().
- To keep things streamlined, JSON key paths are used for the parent-child keys.
- Records are marked as arrays based on the presence of a left bracket (“[“) and formatted accordingly.
Here's a free downloadable FileMaker example file that makes it easy to connect FileMaker to the Google's auto complete addressing module, something I mentioned the other day with another free solution. I figure it never hurts to have more...
Finally, keep a look out for more information by clicking the above frequently updated link.
It's a great time to be alive.