For loops in webhooks?

Is there a way to write the following as a loop in the response area of a webhook? Essentially, I want to get the size of the json and then count up to that number through 0,1…etc. I can do this in C using a json parser, but for teaching purposes, I would like to first demonstrate it as part of the webhook if possible.

{
“stop0”: “{{{data.0.attributes.current_stop_sequence}}}”,
“dir0”: “{{{data.0.attributes.direction_id}}}”,
“stop1”: “{{{data.1.attributes.current_stop_sequence}}}”,
“dir1”: “{{{data.1.attributes.direction_id}}}”,
“stop2”: “{{{data.2.attributes.current_stop_sequence}}}”,
“dir2”: “{{{data.2.attributes.direction_id}}}”
“stop3”: “{{{data.3.attributes.current_stop_sequence}}}”,
“dir3”: “{{{data.3.attributes.direction_id}}}”
}

Nope, there is no flow control in webhooks.

However, JSON allows for arrays or lists via the [...] syntax.

Okay, got it. Yeah, I know how to do this with JSON, just wanted to see if it was possible in webhooks. Is there a way to mark this as solved?

Sam

Yes. You can click the solution checkbox image at the bottom of the post you consider to be the solution.
This may be hidden behind the ellipsis image tho'