Forum Discussion

AbhishekKumar's avatar
AbhishekKumar
Qrew Trainee
4 years ago

How to check length of array and Apply Greater or Less Condition on that array In Pipeline

Hi,
I have a JSON response in which I have JSON array. I want to apply a condition like if length of array is greater then 0 then do some operation else do some other operation in pipeline. JSON Sample like

 
Abhishek


------------------------------
Abhishek Kumar
------------------------------

1 Reply

  • The expression language is Jinja, Jinja2 to be more specific...

    if you're able to drill down in the pipeline steps to reference the JSONArray, then you should be able to do:

    {{ a.JSONArray | length }}

    This isassuming the call is in the a step of the pipeline.

    ------------------------------
    Ryan Stanford
    ------------------------------