Simple Custom Function to flatten JSON Object

Hello,

In an exchange on this post, I shared a custom function which I once wrote, which can be used to "flatten" a JSON object.

The flattened output can take a few different forms, including:

  • A CR-delimited list of all paths found within the object
  • A CR-delimited list of all the values found at the various node-endpoints
  • JSON Array or JSON Object output, which returns both paths and values

The original version of the CF that I posted had a bad bug in it. The version shared with this post has a fix in place for the bug, updated comments, and also a suite of simple tests to help ensure quality.

The CF comes with a few limitations, which are explained in the comments.

I hope that it may be helpful to some.

Kind regards,

-Steve

Path Output:

Array of Paths and Values Output:

Object Output:

Test Case Screenshot:

CF_FlattenJsonObject_20210627_1520.fmp12.zip (92.9 KB)

6 Likes