Casting KV to VARS

Is there a way to convert a KV string to VARS?

Not sure, since they’re different types. Why do you need this?
Nevermind I see. Why not just create a new vars variable and build it based on the kv values?

Yes. What language are you working in?

I tried to assign the bodyContent string value (which is formatted the same way as a VARS value) to a VARS variable, but I end up with this error message in the action log:

image

Here’s the workflow:
Test Integration Gateway Processor.zip (1.2 KB)

Here’s what the HTTPS bodyContent looks like:
{“firstName”:“Colby”, “lastName”:“Ritter”, “middleInitial”:“M”, “suffix”:“”}

I’m using an Expressions block to assign the bodyContent string to a VARS called assignedVAR. Obviously this is not working; what’s the right way to do this?

Figured it out. With bodyContent formatted as described above, I ran it through a Process arbitrary data with jsenv function, using this configuration:

scope(any) : bodyContent

source(string) : return JSON.parse(input)

Target: assignedVAR (in the resultAny field)

assignedVAR ends up as a VARS object, and can be used to scope a subworkflow.