Out of the box, there is no option to output the writeDump() result to a variable. But, when you invoke writeDump(), it will output to the current buffer. This means that we can output it to a variable using CFSaveContent and a user-defined output buffer. Then, we can use the result like any ordinary String variable:
As you can see, we're invoking writeDump() inside the body of a CFSaveContent tag. This allows the output to be written to our CFSaveContent buffer instead of the current request response output buffer. And, when we run the above code, we get the following output:
Just to be clear, I am in no way trying to imply that plain text is better than JSON. I am only saying that in some cases, when my highest priority is readability - not deserialization - I am finding that storing or sending ColdFusion values in writeDump-text format is a fairly nice experience.
Want to use code from this post? Check out the license.