If you have done any development work in Claris FileMaker or worked with APIs, you may have heard references to JSON but not been aware of how to use JSON with Claris FileMaker.
An understanding of how to create and parse JSON formatted text is necessary in order to work with just about any API including the FileMaker Data API. By the way, if you don’t know what an API is, you can learn all the basics about APIs here.
Our Productive Computing University course, API Fundamentals for Claris FileMaker, teaches FileMaker developers how to work with JSON and APIs. And this blog will give you a basic understanding of what JSON is and how it is used with your FileMaker solution.
What is JSON?
Douglas Crawford created the JSON format in the early 2000s, and he and fellow developer Chip Morningstar sent the first JSON message in April 2001. Its birth grew from a need for a real-time server-to-browser communication protocol.
In the last 20 years, its evolvement has exploded, and today it is respected by FileMaker developers for its many advantages:
- It is Human readable. From reading from top to bottom or inside out, you can see the data, and the data will be described.
- It is machine readable. JSON structures its data in ways that are easy for programs to interpret, or 'parse', the documents and extract meaningful information.
- It is flexible, with multiple tables in a single file. Information can be stored as simple values such as text or numbers, complex objects with their own fields and sub-objects, arrays of values, and more.
What are the advantages of using JSON?
Using JSON with FileMaker, you can represent the entire database system – records and fields in a single file, which gives you advantages. For example, if you were working with the Quickbooks API, you could send both the invoice and line items simultaneously in the same file (JSON document) whereas you would think to send them as two separate imports.
Another positive with JSON is the way it handles data compared to Excel (or CSV files). In Excel, you are inclined to fill in data yourself after exporting information, but with JSON, the data is beautifully formatted with indents, almost like a “tree” where labels are continuously displayed throughout the data – “self-describing data.” The JSON text has more symbols, but the text is less clunky and more continuous as the data is beautifully formatted so that everything is easy to see.
The order of the data doesn’t matter to the receiving computer as what matters is the label. Because of the way it is formatted when you put it in an advanced text-editing program like Sublime Text or Notepad++, it allows you to have a variety of neat formatting options. You can collapse or expand the data using left and right arrows and even hide the first set of records if you want.
How do you use JSON with FileMaker?
Working with JSON requires a developer's touch, but thankfully, understanding JSON is not too difficult. We have worked with it enough that we've come up with a series of lessons showcasing the benefits of JSON as well as how to design and implement it in various FileMaker-based use cases.
The API Fundamentals for Claris FileMaker course offers details on using JSON with APIs, including how it’s formatted, why it’s important, how it’s used today, and what makes it different than other formats such as comma-separated text. Developers will learn how to:
- Build their first JSON in the simplest form possible.
- Make a single “key-value pair” as a JSON object and add more formatted data.
- JSON formatting can get more complex as more data is added.
- Read and parse JSON and why it is important when working with APIs.
- Use JSON with FileMaker and Script Workspace and see how there are numerous choices when constructing JSON.
- Create a complex JSON document from a set of multiple company records linked to multiple individuals in a typical CRM
Using JSON is kind of like opening “Pandora’s Box.” You will want to be sure you make the right choices in regard to your formatting and structure. You may find that there are numerous methods and strategies on how to parse the JSON using the available script steps and built-in JSON functions in FileMaker. To lessen the confusion, we discuss many of these options and what we consider to be best practices in our course.
The API Fundamentals for FileMaker course provides developers who are new to the world of JSON a terrific and necessary foundation into the world of working with APIs and FileMaker. We’re excited to see what you can do with your new skills as you learn all about working with APIS and FileMaker.
Additional Blogs, Training, and Resources
If you are interested in additional FileMaker videos, training courses, or product news, please:
- Subscribe to our YouTube channel for FileMaker tips and tricks.
- Subscribe to our newsletter for industry and product updates.
- Check out Productive Computing University for in-depth training courses covering advanced FileMaker technologies.
- Have a look through our blog posts and check out these other FileMaker API posts.