How to use the result of jsonPath as a body in a forthcoming request

Hi there,

we parsed a response-body with jsonPath and save the result in the session:
.check(jsonPath("[0]").saveAs(“XXX”)

What is the best way to use ${XXX} as a body in a forthcoming request?

We use Gatling-nightly build from May

Thanks in advance

– ulrich

What is the best way to use ${XXX} as a body in a forthcoming request?

Well, that depends on what you’re trying to do…

I want to use ${XXX} unchanged as body for the next request. I

What have you tried exactly?

body(StringBody("${XXX}")) should work

Hi Stéphane,
we tried both
body(StringBody("${XXX}") and
body(StringBody("${XXX}").asJSON

but the logs show, that the structure sent is not a JSON object because the attributes are not quoted.
The response body which is saved as XXX is a genuine JSON object of kind {“foo” : “baz”}, but the session contains XXX-> {foo = baz} which is not a JSON object.

OK, get it.
Please open a feature request.

And until then, I’m afraid you’ll have to inject the values back into a new template.