I just removed the sample file with the CF to flatten an object because I found a bad bug in it.
@SunrayBrad and anyone else who downloaded the file: My sincere apologies.
I have just reworked the function to patch the bug. Later today I will review and test my changes some more, and if all looks well, I will post the fix.
So that the bug and circumstances are clear:
If the original version of the CF is supplied JSON which uses a newline character (carriage return or line feed), then the function will will beach ball (hang) as it attempts to do endless recursion.
The flaw in my code is that I did not account for the fact that JSONListKeys does not allow us to detect when a key happens to contain a newline. This resulted in a circumstance where the steps in the function which determine whether to perform a recursion can be thwarted, because the list of keys determined via the use of JSONListKeys may be incorrect.
The resolution was to add in a step which validates each key that it operates with, and, in the event that a bogus key is detected, the function now returns an error message.
The above example has well-formed JSON. However, it contains a key with a carriage return in it. This is the type of condition which would have broken the original version of the function that I posted. It is, of course, not a likely scenario, but it is certainly allowed. A fix was definitely in order.
I'll give myself most of the day to take my eyes away from the code -- then I will re-review and test, and post back here.
@SunrayBrad : Sorry for somewhat hijacking your thread here -- I just wanted to make sure I let you and others know about this.
All the best.