Iterate through a json/list

Hi team,

I want to run an action for each key/value in a json/list result which is returned from the previous block. Is there any OOTB solution which I can use to iterate through a json/list?

Thanks,
Nick

1 5 714
5 REPLIES 5

Hi Nick, 

Have you looked anything in the power ups section yet?  There may be something relevant in there.  If it doesnt fit that exact use case, you could always modify the power up through the IDE.

Yes, I did. I couldn't see anything that helped me iterate through a json result there. Actually, I canโ€™t even see a for loop function which is commonly used in automations. Itโ€™s so weird that Google SecOps SOAR doesnโ€™t have this basic feature.

I agree, I also tried to use the Jinja2 engine but couldn`t find anything for a loop.

Google SOAR team, if this solution is possible please share documentation and best practices, all other SOAR solutions have a FOR loop.

Hi @ORBR,

Have you tried using 'Render Template from Array' - "Render Template, but for lists. Loops through a list and applies the Jinja template to each list item."

Kind Regards,

Ayman

For processing data, yes Render Template from Array works

If you can turn the data into Entities, then most Actions which use Entities have looping natively built in

If not and the data must remain as a String/JSON this is not implemented today. Your options are to duplicate an Action and loop the lines of Python to do this, or ask your support reprepsentitive for a roadmap call to discuss playbook looping.

HTH