My Scala knowledge is sparse at best, I apologize if this is trivial.
I need to grab a value from several response bodies, which I then want to store in a List in the Session, sometime later in the scenario, I want to take this list, and render it as a JSON array for an HTTP request body.
I’m struggling to figure out how to accomplish this with Scala and Gatling.
Has anybody done this before?
Thanks in advance for your help,
The only thing I could think is to collect the List and create a string using mkString in the desired format. Then in your request do .get(string).asJSON.
Unless I do not understand the question, shouldn’t that work?
As you suggested I was able to do render the Array as a JSON array by doing something like this:
val xs = Array(“apple”, “banana”, “cherry”)
xs: Array[String] = Array(apple, banana, cherry)
xs mkString("["", “”, “”, “”]")
res0: String = [“apple”, “banana”, “cherry”]
– Carlos Torres