Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


Privacy Policy

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.


 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

padJSON (JSON ; rowLabels ; columnLabels )

Rate this function:  

  Average rating: 4.0  (6 votes)
  Discuss this Custom Function

Michael Kupietz, FileMaker Pro Consultant, FileMaker Pro Consultant

Pad out JSON string to two-dimensional array with null values

Sample Input:
Sample Output:

 Then copy & paste into FileMaker Advanced's Edit Custom Function window.


I needed a function to pad out JSON strings into full 2-dimensional arrays*, without overwriting existing data. For example, if:



padJSON ( $$JSON ; "A¶B¶C¶D¶E" ; "1¶2¶3¶4" ) =


which is a full 5x4 array with existing keys for every permutation of the label lists "A¶B¶C¶D¶E" and "1¶2¶3¶4".

My reasons for needing this function are my own. I'm involved in some very dark JSON doings.

Note that this function has been needlessly complicated by the fact that FileMaker's value list functions insert garbage carriage returns... IE, rightvalues("A¶B¶C",1) is "C¶". So I I had to add the variables "theRightRowValues", "FileMakerFixRows", "theRightColValues", and "FileMakerFixCols" to work around this, marring the pristine beauty of my formerly elegant custom function. Oh well, it's a living.

(*Please note I am referring to an abstract tabular array of data, not a literal JSON array, which requires brackets. We apologize for any confusion caused. The parties responsible have been sacked.)

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

This is my Custom Function and I want to edit it


There was a glitch in the first version I posted. It would return a JSON error on the last row if you passed it a null value "" in the JSON field instead of a valid JSON string. Fixed now.

For now, it will probably still choke if you pass it invalid JSON, but at least if you pass it nothing it will reply with an valid empty, initialized JSON array. This way you can auto-enter initialized JSON arrays into text fields on creation.

Mike Kupietz, Bay Area, CA
July 07, 2017 8:57pm

Terminologically, you don't use brackets [], so it is not array.

19752, Japan
July 12, 2017 12:56am

It's not a JSON array. The data is a two-dimensional array, rows and columns of tabular data. In terms of the JSON structure, yes, it's stored in an ordinary JSON object, not a JSON array. I've added a clarification to that effect.

Michael E. Kupietz, FileMaker Consultant, San Francisco, CA
July 12, 2017 10:32pm

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 6 + 5 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
2. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
3. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
4. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
5. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
6. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
7. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)
8. @JSONFormatElements ( json )
  (Tue, May 15, 3:31am)

RSS Feed of Custom Functions