Lil help with jsonPath

Hi,

I’m very new to Gatling and Scala and would appreciate some help with my jsonPath. Gatling v2.2.0

Shortened version of my json:

{ “links”: [ { “href”: “http://some.link” }, { “href”: “http://another.link” } ], “content”: [ { “createdAt”: “2016-04-08T16:38:46.576Z”, “updatedAt”: “2016-04-20T09:10:51.839Z”, “id”: “0000658E8EF377DBE82E60B2492FFF12”

},

{ “createdAt”: “2016-04-08T16:38:46.576Z”, “updatedAt”: “2016-04-20T09:10:51.839Z”, “id”: “0000658E8EF377DBE82E60B2492FFF12”

}
]
}

So I just basically want to get the list of all content[].id and save them in the session. Have tried various jsonpaths to no avail.

.check(jsonPath("$…content[].id").findAll.saveAs(“myIds”)))
.check(jsonPath("$…*.id").findAll.saveAs(“myIds”)))

printing out “myIds” values with println.session(“myIds”).as[String] only gives me my entire json string (or probably the entire “content” bit as it’s too huge the console trims the output)
while the console says jsonPath($…*.id).findAll.exists, found nothing

Any ideas?

Edit: tried $content[*].id which seems most logical at my case (https://jsonpath.curiousconcept.com/) but nothing; and I get

Hi,

you just need 1 “.” because “content” is at the root of your json, so you should use $.content[*].id
In this shortened version you could use $…id because there are no other branch with “id” in it