I am trying to parse a json response returned to gatling by the server.
My response from server is:
SessionAttribute(
Session(
GetServices,
3491823964710285818-0,
Map(
gatling.http.cache.etagStore -> Map(https://api.xyz.com/services -> ),
gatling.http.cache.lastModifiedStore -> Map(https://api.xyz.com/services -> ),
myresponse -> {
"created":"2014-12-16T22:06:59.149+0000",
"id":"x8utwb2unq8uey23vpj64t65",
"name":"myservice",
"updated":"2014-12-16T22:06:59.149+0000",
"version":null
}),
1418767654142,622,
OK,List(),<function1>),id)
I am doing this in my script:
val scn = scenario("GetServices")
.exec(http("Get all Services")
.post("/services")
.body(StringBody("""{ "name": "myservice" }""")).asJSON
.headers(sentHeaders)
.check(jsonPath("$")
.saveAs("myresponse"))
).exec(session => {
println(session.get("id"))
session
})
It is still printing the whole response. How can I just retrieve the id which is "x8utwb2unq8uey23vpj64t65"
?