-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
hi
For the json path = $['tool']['books'][*]['properties'][*][? (@['name'] == 'moq') ]['value']
the output based on the json below should be ["x","q"]
but i get []
I get the correct output when using
- java json path library (com.jayway.jsonpath.json-path 2.7.0)
- or if test from the website http://jsonpath.herokuapp.com/
- or if test from the website https://www.javainuse.com/jsonpath
i tried alternative json path json_path='$.tool.books.[*].properties.[*].[?(@.name=="moq")]'
i get weird printed errors = [2022-11-02 15:43:23]-ERROR-[jsonpath] string indices must be integers
sample json is as follows:
{
"tool": {
"jsonpath": {
"creator": {
"name": "Jayway Inc.",
"location": [
"Malmo",
"San Francisco",
"Helsingborg"
]
}
},
"books": [{
"title": "Beginning JSON",
"price": 49.99,
"properties": [{
"name": "moq",
"value": "x"
}, {
"name": "url",
"value": "1"
}]
},
{
"price": 1.99,
"properties": [{
"name": "url",
"value": "3"
}]
}, {
"title": "JSON at Work",
"price": 29.99,
"properties": [{
"name": "moq",
"value": "q"
}, {
"name": "url",
"value": "2"
}]
}
]
}
}
Metadata
Metadata
Assignees
Labels
No labels