I have a json feeder reading from a file a json array like this:
[{ "a": {"b": 1} }, { "a": {"b": 2} }]
When I use it for a request body it's sent like ArraySeq(HashMap(..
instead of the actual json. How can I convert the Parsed Json back to Json keeping the feeder approach?
val jsonFileFeeder = jsonFile("requests.json").circular
val scn = scenario("cost estimation")
.feed(jsonFileFeeder)
.exec(
http("request_1")
.post("/")
.body(StringBody(
"""{
"a": "${a}"
}"""
)).asJson
)
Use jsonStringify()
, see documentation.
val jsonFileFeeder = jsonFile("requests.json").circular
val scn = scenario("cost estimation")
.feed(jsonFileFeeder)
.exec(
http("request_1")
.post("/")
.body(StringBody(
"""{
"a": "${a.jsonStringify()}"
}"""
)).asJson
)