Hi dear community. I capture an array as a session variable.
Next i want to get a random index from that array, and save some more values that are located under that index.
I have tried lot of things. Nothing helped.
In the code below the menuArray is the the array I need.
i want somehow to call it as JSON object, in order to make some iterations on it and access some values in it.
object subscribe_menu_by_filter_1 {
val subscribe_menu_by_filter_1 = http("subscribe_menu_by_filter_1")
.post(cache_url+"/api/Publisher/subscribeMenuByFilter")
.body(ElFileBody("jsonPayload/subscribe_menu_by_filter_1.json")).asJson
.check(status.is(200))
.check(jsonPath("$['d']['d'][*]['g']").saveAs("menuArray"))
val randomExtractor = exec { session =>
val myArray = session("menuArray").as[String] // Assuming menuArray is a JSON array of strings
//here I need a snippet for making myArray as JSON OBJECT
session
}