-
Notifications
You must be signed in to change notification settings - Fork 195
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
Filters not implemented #54
Comments
+1 |
6 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+10086 |
Contributions welcome! I will try to get existing pull requests resolved and find some more committers here, since I have no time to add features. |
I wonder if people are aware of the adjacent projects that do contain
support for filtering? ext and ng
…On Fri, Sep 28, 2018, 10:52 PM Kenn Knowles ***@***.***> wrote:
Contributions welcome! I will try to get existing pull requests resolved
and find some more committers here, since I have no time to add features.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#54 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGpw5jaRQq9cT1Os7QplRiVdeR7CwKVEks5ufuBlgaJpZM4QVRG0>
.
|
and |
http://www.ultimate.com/phil/python/#jsonpath this one works |
Just a note for those looking for negation on filtering.. eg. |
If you are looking for filtering then jsonpath2 or Phil's library as suggested by @district10. I just thought I should add a sample use for Phil's library as it took me a while to find it. For everything else, I much prefer this project (functionality, robustness, documentation and community) import jsonpath
#get specific value of a
contents ={
"id": 534253245,
"sku": "23453245324",
"name": "Sample",
"attribute_set_id": 23453245,
"price": 23453245,
"status": 1,
"visibility": 1,
"created_at": "1989-07-19 08:43:36",
"updated_at": "1989-07-19 08:43:36",
"weight": 453,
"custom_attributes": [
{
"attribute_code": "meta_title",
"attribute_value": "Sample Meta Tile"
},
{
"attribute_code": "meta_keyword",
"attribute_value": "Sample"
}
]
}
jsonpath.jsonpath(contents,'$.custom_attributes[?(@.attribute_code=="meta_title")].attribute_value')
#Output:
#['Sample Meta Tile'] Equivalent for jsonpath2 from jsonpath2.path import Path
p = Path.parse_str('$.custom_attributes[*][?(@.attribute_code="meta_title")].attribute_value')
list(map(lambda match_data: match_data.current_value, p.match(contents))) |
Hi, thanks for your work on making a jsonpath library for Python.
I think this library might have a bug or are missing this part of the spec:
I'm trying to filter an array by a string. My query, `$.phoneNumbers[?(@.type=='home')].number, works fine on the jsonpath.com testing tool, but I can't get it working using jsonpath-ng. It fails to parse the query, complaining about the question mark.
Example code:
Exception:
JsonPathLexerError: Error on line 1, col 15: Unexpected character: ?
I'm trying this with jsonpath-rw>=1.4.0
Any ideas? Am I doing something wrong?
The text was updated successfully, but these errors were encountered: