Picking the 8 first occurrence in a JSON response

given my working simulation, this gives me all the occurrences of instances in a json response:

`

.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[?(@.activationDate==null)].offerId").findAll.optional.saveAs(“itemList”))

`

and this gives me the fist one in the same response:

`

.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0].offerId").findAll.optional.saveAs(“itemList”))

`

but how can I get just the 8 first occurrences?

This does not work:

`
.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0-7].offerId").findAll.optional.saveAs(“itemList”))

`

Thanks

.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0,1,2,3,5,5,6,7].offerId").findAll.optional.saveAs(“itemList”))

Can you not do a ‘take’ or a ‘dropWhile’ on the full collection or something?

From JsonPath’s spec: http://goessner.net/articles/JsonPath/

Thanks guys,

.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0:8].offerId").findAll.optional.saveAs(“itemList”))

Is it possible to combine ?(@.activationDate==null with [0:8]

in one expression?

I have

`

.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[?(@.activationDate==null)].offerId").findAll.optional.saveAs(“itemList”))

`
and

`

.check(jsonPath("$.membershipCoupons[?(@.membershipId==’${MemberId}’)].coupons[0:8].offerId").findAll.optional.saveAs(“itemList”))

`

something like:

.check(*jsonPath*(**"$.membershipCoupons[?(@.membershipId=='${MemberId}')].coupons[?(@.activationDate==null) &&** **[0:8]****].offerId"**).findAll.optional.saveAs(**"itemList"**))

?