Back to Blog
2025-12-22 4 min read

FileMaker Script Performance with JSONParse

For years, FileMaker developers have accepted a specific performance tax when working with large JSON payloads. Every time you called JSONGetElement, the calculation engine had to re-parse the entire text string looking for your key. In a loop of 1,000 iterations, that meant 1,000 full parses.

With Claris FileMaker 2025 (v22), that architectural bottleneck has been dismantled. The introduction of JSONParse and the new internal In-Memory Binary Representation of JSON fundamentally changes how we write high-performance integration scripts.

The Problem: The "Re-Parsing Tax"

In previous versions of FileMaker, JSON was treated as a standard text string. Consider this common pattern:

# Loop through a large JSON array of 5,000 items
Set Variable [ $i ; Value: 0 ]
Loop
    Exit Loop If [ $i = $totalCount ]
    Set Variable [ $id ; Value: JSONGetElement ( $jsonPayload ; "[" & $i & "].id" ) ]
    Set Variable [ $status ; Value: JSONGetElement ( $jsonPayload ; "[" & $i & "].status" ) ]
    Set Variable [ $i ; Value: $i + 1 ]
End Loop

In the example above, FileMaker parses the $jsonPayload text string twice per iteration. If the payload is multi-megabyte, the script slows to a crawl as the engine repeatedly re-processes the same text.

The Solution: JSONParse and Binary Caching

FileMaker 2025 introduces a native "parsed state." When you use JSONParse ( $json ), FileMaker processes the text once and stores a binary representation in memory.

Syntax:

JSONParse ( json )

When you store the result of JSONParse in a variable, subsequent calls to that variable using other JSON functions (like JSONGetElement or JSONListKeys) skip the parsing phase entirely and read directly from the cached binary structure.

The "Parse Once, Read Many" Pattern

Here is how to refactor your scripts for immediate performance gains:

# 1. Parse the payload ONCE and store in a variable
Set Variable [ $parsedJSON ; Value: JSONParse ( $jsonPayload ) ]

# 2. Iterate through the parsed variable
Set Variable [ $i ; Value: 0 ]
Loop
    Exit Loop If [ $i = $totalCount ]
    # These calls are now near-instantaneous
    Set Variable [ $id ; Value: JSONGetElement ( $parsedJSON ; "[" & $i & "].id" ) ]
    Set Variable [ $status ; Value: JSONGetElement ( $parsedJSON ; "[" & $i & "].status" ) ]
    Set Variable [ $i ; Value: $i + 1 ]
End Loop

Benchmarks from the community (and partners like BeezWax) show that for large arrays, this refactor can drop execution time from minutes down to milliseconds.

Validation with JSONParsedState

Along with speed, FileMaker 2025 gives us better tools for stability. Historically, we checked for valid JSON by looking for a "?" at the start of the result. Now, we have a dedicated function:

JSONParsedState ( json )

  • 0: Plain text (not parsed).
  • -1: Invalid JSON (parsing failed).
  • Positive Integer: The JSON element type (1 for Object, 2 for Array, etc.).

Robust Error Handling Pattern:

Set Variable [ $parsedData ; Value: JSONParse ( $rawResponse ) ]

If [ JSONParsedState ( $parsedData ) = -1 ]
    # Handle the error cleanly
    Perform Script [ "Log Error" ; Parameter: $parsedData ]
    Exit Script [ Text Result: "Malformed JSON" ]
End If

Architectural Tips & Best Practices

  1. Memory vs. Storage: The binary representation lives only in memory. If you set a field to the result of JSONParse, FileMaker converts it back to text for storage. Always store your parsed JSON in a Variable ($) or Global Variable ($$) for the duration of your script's logic.
  2. Automatic Caching: FileMaker 2025 is smart—it automatically caches the last JSON string used. However, explicitly using JSONParse is safer, especially when your script alternates between multiple different JSON objects in the same loop.
  3. Large Payloads: If you are integrating with high-volume APIs (like Amazon Seller Central or complex ERP systems), JSONParse isn't just a "nice to have"—it's an architectural requirement to avoid system lock-ups.

Conclusion

FileMaker 2025 transforms JSON handling from a text-processing chore into a high-speed data operation. By implementing the JSONParse pattern, you can eliminate latency, reduce server CPU load, and provide a significantly snappier experience for your users.

Is your API integration architectural still relying on complex plugins? Check out my guide on Native API Integration Patterns.

Resources

For further reading and official technical specifications, refer to the Claris FileMaker Pro 2025 documentation:

FileMaker Script Performance with JSONParse | Jeffrey Henry