Looping through Json array

Hi ,

I am using Json compile , whose output is Jsonarray ([“12”,"13,“14”]). Now i need do loop through them and execute some set of actions and provide each content in array as input for each iteration. I tried for each but i could not figure out. Please let me know
Package is : net.minidev.json.JSONArray

val imageAreaId : JSONArray = JsonPath.compile("$…imageAreas[*].id").read(pageData)


Could you share a gist please?

This is my scenario, I have a service which returns JSP and json is a part of output. So as you had suggested before I am doing regex to extract json and storing in my session.

Then I am doing Jsonpath compile as below

val imageAreaIds : JSONArray = JsonPath.compile("$…imageAreas[*].id").read(pageData)
session2 = session2.setAttribute(“imageAreaIds”,imageAreaIds)

Now i need to use these imageAreaIds and run the test as many times i have ImageAreaIds.