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

Json path query is not working as expected #120

Closed
harishpalepu opened this issue Sep 9, 2015 · 2 comments
Closed

Json path query is not working as expected #120

harishpalepu opened this issue Sep 9, 2015 · 2 comments

Comments

@harishpalepu
Copy link

JSON :
{
"key" : "value",
"array" :
{ "key" : 1 },
{ "key" : 2, "dictionary": {
"a": "Apple",
"b": "Butterfly",
"c": "Cat",
"d": "Dog"
} },
{ "key" : 3 }
]
}

Extraction Query:
$.array[?(@.key=2)].dictionary.b

Result:
[
"Butterfly"
]

Im trying using your library giving an output of empty list

validationObj.jsonPath ="$.array[?(@.key=2)].dictionary.b"

JsonPath.read(responseJSONData, validationObj.jsonPath) -->[ ] instead of ["Butterfly"]

Please your help is appreciated

@frmichel
Copy link

frmichel commented Sep 9, 2015

Hi, just as an information I guess this is related to one of the concerns I've raised in this issue: #114

@warwickhunter
Copy link

Here is the correctly formatted JSON.

{
"key": "value",
"array": [
{
"key": 1
},
{
"key": 2,
"dictionary": {
"a": "Apple",
"b": "Butterfly",
"c": "Cat",
"d": "Dog"
}
},
{
"key": 3
}
]
}

I think this expression gives the answer you seek.

$.array[?(@.key==2)].dictionary.b

On 9 September 2015 at 16:13, Franck Michel notifications@github.com
wrote:

Hi, just as an information I guess this is related to one of the concerns
I've raised in this issue: #114
#114


Reply to this email directly or view it on GitHub
#120 (comment).

Warwick Hunter
K1300S/R1200GSA m: +61 4 1242 1576 skype: warwickhunter

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

4 participants