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?
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.
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.
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?
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!
Was there any luck with being able to create something to easily loop through a json object that is returned from a rest call? I am running into a similar issue with not being able to loop through a json object and was hoping to avoid the Python route.
What’s your issue? The output for the HTTP request plugin can be modified by clicking the edit button under Output to match the output you are expecting from the API call. If there is an array nested in that object you can declare it as such and then loop over it.
Sorry for the delay and for not responding sooner. I actually figured out how modify the output variables so that you can loop over the returned results. Just had to make sure that it was setup correctly.