Open markb-trustifi opened 7 years ago
Hello!
I'm experiencing same issue. Looks like there is no way to receive array of values even if JSON path supports that. I took a look at code and looks like this is expected behaviour https://github.com/artilleryio/artillery/blob/master/core/lib/engine_util.js#L499. Looks like if we receive multiple values from JSON path code is choosing random value.
Can I know what is a reason behind this piece of code ?
In the function of extractJSONPath()
in engine_util.js
, it takes a random value if the result is an array which length is more than 1.
if (results.length > 1) {
return results[randomInt(0, results.length - 1)];
} else {
return results[0];
}
I suggest that this behavior(picking ramdom one) should be only applied as a property such as randomPick: true
.
I think many users may want to use a full array itself not an item which is picked randomly.
I receive an array of data from a http response:
These expressions are supposed to print an array of _id's but I get only single value: $.._id $[0,2]._id
This expression is supposed to print a length of an array but prints the whole expression "$.length": $.length