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.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed


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 4 + 8 =
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. ExcludeValues(MyList ; Out)
  (Wed, Mar 21, 7:23am)
2. PreviousMonthEndDate ( myDate )
  (Wed, Mar 07, 3:35am)
3. PreviousMonthName (myDate)
  (Wed, Mar 07, 3:33am)
4. FmTableFields ( tableName ; fieldsInclude ; fieldsExclude ; classExclude ; typeExclude ; prefixExclude )
  (Fri, Mar 02, 6:32am)
5. sql.getTable ( fullyQualifiedFieldObject )
  (Thu, Feb 22, 8:36am)
6. sql.getField ( fullyQualifiedFieldObject )
  (Thu, Feb 22, 8:34am)
7. FilterOut ( ListA ; ListB )
  (Wed, Feb 21, 6:11pm)
8. Char0 ( )
  (Sun, Feb 18, 2:35am)

RSS Feed of Custom Functions