Handling JSON Objects as Outputs from Triggers/Steps

Hi all,

We have been working with AWS SQS as trigger for a workflow.

In the body we include a JSON formatted message, we are getting the info in the WF as an Output, but my question is how to correctly re-assign the data-type to the body inside InsightConnect to treat it as an Object.

The data type for body was changed from String to Object… but nothing works.

Also my question is, how do you handle JSON objects in WF?


1 Like

That looks like you’re doing the right thing.

You can get at objects with the dot operator like you’re showing in the example pic…so
{{["step name"].[object name].[object attribute]}}

Can you post sample JSON here and maybe we can. be more helpful?

1 Like

It would be nice if the “Enter JSON” feature in an API Trigger was available for other Actions as well. With HTTP Request I find myself manually adding object members so they show up in the blue plus sign in following steps and if I could just pop in the JSON returned it would save a bunch of time.


+1 on the feature @brandon_mcclure.

This would save lot of time.

I think i need to do more labor with Handlebars to check. I will keep you posted! Thanks.

Well, no luck with Handlebars. @joey_mcadams

This is how the output looks in the SQS Trigger:

Screenshot 2021-01-20 at 17.18.14

In the default config, the output variable body is String. We changed the data type to Object then on an artifact did

{{#each ["New SQS Message"].[body]}}

Still nothing, maybe i’m missing something?

So I’m trying to read that screenshot…so forgive me if I got that wrong, but it looks like this to me.

{"from_port":1194, ...}

In which case {{#each}} won’t work there. It’s a single object, where I think #each is expecting an array.

I think you just want
{{["New SQS Message"].[body].[id]}}

You got it right.

It is something like {"from_port":1194, "instance_id":"a-bcd123", "to_port":1194, ...}

But still when using {{["New SQS Message"].[body].[instance_id]}} or {{["New SQS Message"].[body].[to_port]}}

I get no value in return,


1 Like

So I’m betting that body is popping out as a string despite trying to force it into an object. I’m doing some test WFs on my side to see how to best handle that.

1 Like

I ended up having to do this…


The code for the python step is this.

def run(params={}):
    import json
    output = json.loads('{{["Test JSON"].[content]}}')
    return {"output": output}

Note I put the actual variable containing the json object in the code. You can pass it in a param, but that’s usually easier.

Here’s what popped out at the end.



1 Like


I also had that in mind, tried at first with regex… but having it as an Object helps you to avoid errors.

Thing is creating more steps, when one could have solved this, it’s not efficient… but at the end it might have to be there the python.

Thanks @joey_mcadams

1 Like

To address that feedback, we’re talking about this problem internally and we’ll come up with an easier way to do that. It’s not a good user experience.

I also think when you set that var as an Object and it’s not an Object is a bug. So we’ll look at that too.

But thanks for pointing this out and sorry for the inconvenience. We’ll get it fixed.


It would be really useful to just have a universal “Extract JSON” plugin that could be added in between steps as a way to create variables without having to know or define their names.

An awesome step further would be to have one that parses other formats like… xml? :face_vomiting:

1 Like

Would the handlebars #with work here?
It looks like an object and not an array, so I do something similar with Active Directory JSONs

{{#each ["Active Directory Users"].[results]}}
{{#with attributes}}
*  {{distinguishedName}}

Or a Type Converter of String to Object? I have to do that sometimes with the output of a Join or Loop even it the input is object


We’ve got JSON and JQ that do what you’re asking, but IMHO they’re not the easiest plugins to use. That’s why I went with python for the above example. But yes, we’re looking into that exact problem.

Thanks for the feedback, it’ll help us prioritize!

1 Like