Pushing Podio

Fun Experiments pushing Citrix Podio to the limit so you can get more done.
... with a little help from GlobiFlow, ProcFu, and other friends ...

Fixing JSON Objects for GlobiFlow Variables

- Posted in Uncategorized by

Very often, if you work with JSON data in GlobiFlow (or any data really) that contains escaped content, GlobiFlow will not be able to perform any functions on that data in variables. They will always return false. This is a limitation in how GlobiFlow tries to re-escape already escaped content.

The simplest example is this JSON object with escaped quotes in it:

No matter what you try to do with this JSON object, GlobiFlow will fail.

So what to do?

Although there is a ProcFu script to find data inside JSON, it is not feasible if you need to get many values from the same JSON object. It would take too many calls to ProcFu and just needlessly slow down the flow.

The simple work-around is to use the new ProcFu script base64_encode.pf. It simply takes any text passed to it and base64 encodes it, which is safe across the board.

To use the encode data in GlobiFlow, you simply replace:

json_decode([token], true)["key"]

with:

json_decode(base64_decode([token]), true)["key"]

Here is the example from above again with JSON we know to break GlobiFlow:

But this time, it works:

Anytime you suspect an API call to return possibly dangerous escaped data, simply encode it with base64_encode.pf and then use the result in your GlobiFlow variables and functions.

Comments