Format Json Response Problems

Can you clarify what “then set variables” means in this context?

If your goal is basically to get a true/false response if “Labor Day” is in any of the items, I think you could do it with some syntax in the /math lab endpoint.

Take this example which checks to see if an array has a certain exact text match in any of the objects. You can literally enter this into the formula field on https://lab.sharptools.dev and see it in action:

count(filter([{"name": "test"}, {"name": "no match"}], equalText(x.name, "test"))) > 0

We start with an array of objects and apply a filter() to it with a callback that returns true/false.

filter(items, callback)

So our callback is equalText(x.name, "test") which is basically checking of any of the name properties in any of the objects is "test". The result of that is the array of objects which match the condition.

From there, we can check the count of items in the filter() response. If the count of items is greater than 0, then we know at least one item had our match.


So in your case, I believe the example would be a POST to the /math endpoint with a configuration like:

{
"formula": "count(filter(holidays, equalText(x.name, 'Labor Day'))) > 0",
"holidays": $context.response.data.response.holidays
}

That would return a true or false in the $context.response.data.result variable.