-
Notifications
You must be signed in to change notification settings - Fork 860
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
Retrieve field values with multiple conditions #319
Comments
@ngarg-kr you can chain queries for additional fields, so in your case with query:
you get: [44] See https://github.com/tidwall/gjson/blob/master/SYNTAX.md#queries and https://github.com/tidwall/gjson/blob/master/SYNTAX.md#dot-vs-pipe for additional information. |
@volans- Thanks! It worked |
@sukant-kr So for example with query:
you get: [44,44,47] Because the first friend matches both queries. You can at that point either get the parent objects and remove duplicates in your code.
and putting them together. Here's the query:
and you get: [47,44] |
Hi @volans-, Guys, need your help.
Output:
I desperately need to receive a path to queried result, but it's not returned for the query with multiple values. Thank you in advance, |
For a sample payload like this:
If we want to get the age of friend whose last name is
Murphy
and first name isDale
then what gjson expression will give that result.I tried
friends.#(last == "Murphy" && first == "Dale")#.age
but it gives an empty array in response.@tidwall kindly help regarding this
The text was updated successfully, but these errors were encountered: