Forum Discussion

JoostDG's avatar
Frequent Contributor
7 years ago

<BUG?> SOAPui 2.3.0 (@.length-1) JSON Path notation



I want to assert a content to another content from a previous rest request. Specific example: sorting. I want to make sure that my last result in the list becomes the first when I revert the sorting parameter.

This used to work in 2.2.0. a previous version.


I use the JSONPath expression assertion to check:

current_request_Response_$['List'][0]['Name'] = previous_request_Response_$['List'][(@.length-1)]['Name']


Now SOAPui 2.3.0 cannot retrieve the (@.length-1) it seems. Doesn't matter trying to use dot notation instead of bracket notation, the result is the same.


I can rewrite my assertion to $..List[-1:].Name but then I get a list, because the [-n:] expression always returns lists.... which still fails my assertion as my current_request_Response is not a list value (i.e. does not have [] brackets around it).


Really annoying. 


Info I consulted:


Error I got: 

com.jayway.jsonpath.InvalidPathException: Could not parse token starting at position 1. Expected ?, ', 0-9, *

2 Replies