JSONFormatElements and JSON pretty-printing
BeginnerUse JSONFormatElements to produce human-readable indented JSON, and understand when compact vs. formatted output is appropriate.
What you'll learn
- How JSONFormatElements() formats a JSON string
- When to use formatted JSON vs. compact JSON
- How to verify JSON validity using JSONFormatElements
- How to build and inspect nested JSON structures
FileMaker stores and transmits JSON as compact single-line strings, which are efficient but unreadable when debugging. JSONFormatElements() reformats any valid JSON string with proper indentation, making it easy to inspect in a field or script variable. Knowing when to use formatted vs. compact JSON is important for both debugging and API integration work.
1/4
1
JSONFormatElements basic usage
Pass any valid JSON string to JSONFormatElements() and it returns an indented, human-readable version. If the JSON is invalid, it returns "?".
FileMaker Script
Let ( raw = '{"name":"Agnes","role":"admin","active":true}' ;
JSONFormatElements ( raw )
)
// Returns:
// {
// "name" : "Agnes",
// "role" : "admin",
// "active" : true
// }Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo