问题
If I have a response of this kind:
{
"A": 2,
"B": [
{
"CCC": "abcde",
"DDD": {
"EEE": 11,
"FFF": 22
}
},
{
"CCC": "fghij",
"DDD": {
"EEE": 111,
"FFF": 222
}
}
]
}
how can I get all the values CCC in a list or otherwise?
If I use:
.check(jsonPath("$..CCC").saveAs("VARIABLE"))
I only get the first CCC ("abcde"). Doing it via CCC[*] throws an error.
回答1:
I think, you should have to add findAll in check statement.
for example:
.check(jsonPath("$..[*].CCC").findAll.saveAs("VARIABLE"))
And please define your error.
Cheers, Peekay
来源:https://stackoverflow.com/questions/42277962/gatling-extract-data-from-json-array-response