Brian Dunning's FileMaker Custom Functions

cf_JSONrecord ( fieldList ; JSON )

This will take a record and recursively create the field and contents as a JSON object.

  Be the first to rate this function Log in to vote

Jason Lecureux   Jason Lecureux - Show more from this author

Share on Facebook Share on Twitter

  Sample input:
cf_JSONrecord ( List ( Key, Name); "" )
  Sample output:
{"key": 12345,"Customer": "Keith"}

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

You will also need the "Supertrim" custom function or some other way to remove the "\r" after the field name. (UPDATE: I've had better success with the Trim4 cf)
The "FieldNames" function pairs nicely if you want all the fields for a given record. Keep in mind this uses a layout to gather field names. If a field you want is in the table but not on the layout it won't show up.
This hasn't been tested with portal data.



belg4mit   belg4mit
Aug 19, 2022
Using SetElement's default variable type does not work for numerous field types including containers and fields with repetitions.; the latter would be best represented by an array.
Jason Lecureux   Jason Lecureux
Aug 22, 2022
Thank you for the response @belg4mit. I can't comment on the plausibility of having compatibility for those fields types. That is beyond my capabilities.

Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 18 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: