Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AND operator not working in jsonPath #19

Closed
kaamos91 opened this issue Jul 15, 2019 · 1 comment
Closed

AND operator not working in jsonPath #19

kaamos91 opened this issue Jul 15, 2019 · 1 comment

Comments

@kaamos91
Copy link

Hi!
I tried to use a multiple condition filter in a jsonPath
like:
$[?(@.invoiceNum='${value1}' && @.issueNum=${value2})].issueDate
but the and operator doesn't work (i guess the or operator is the same).
I get a parse error:
Invalid JSONPath query '$[?(@.invoiceNum='1111111' && @.issueNum=1)].issueDate': Parse error at 1:28 near token & (&)

@elrandira
Copy link
Collaborator

I know this is 3years old but I couldn't reproduce your error with the following syntax and Goessner's data model.

Note that the keyword for AND is just one '&', not two

*** Test Cases ***
test and in jsonpath
    ${obj}=    Load JSON From File  ${CURDIR}/bookstore.json
    ${value}=  Get Value From Json  ${obj}  $..book[?(@.category='fiction' & @.price>10)].title
    log to console  ${value}

Execution:

==============================================================================
Test
==============================================================================
test and in jsonpath                                                  ...
['Sword of Honour', 'The Lord of the Rings']
test and in jsonpath                                                  | PASS |
------------------------------------------------------------------------------
Test                                                                  | PASS |
1 test, 1 passed, 0 failed
==============================================================================

I propose to close this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants