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

Question on Nested Search #4

Open
spirrello opened this issue Mar 7, 2018 · 3 comments
Open

Question on Nested Search #4

spirrello opened this issue Mar 7, 2018 · 3 comments

Comments

@spirrello
Copy link

Hi,

Using your example on the readme, how would you go about querying one of the nested values such as one of the skills?

Does this look right?

fmt.Println(parser.Query("name='elgs' && skills[]=Java"))

{
"name": "elgs",
"gender": "m",
"age": 35,
"skills": [
"Golang",
"Java",
"C"
]
},
{
"name": "enny",
"gender": "f",
"age": 36,
"hobby": null,
"skills": [
"IC",
"Electric design",
"Verification"
]
},
{
"name": "sam",
"gender": "m",
"age": 1,
"hobby": "dancing",
"skills": [
"Eating",
"Sleeping",
"Crawling"
]
}

@elgs
Copy link
Owner

elgs commented Mar 7, 2018

Try this:

"skills.[1]='Java'"

Shame on me. This should be put in the doc. It can be found from the jsonql_test.go. jsonql depends on https://github.com/elgs/gojq. So you might find gojq examples helpful.

@spirrello
Copy link
Author

spirrello commented Mar 7, 2018 via email

@elgs
Copy link
Owner

elgs commented Mar 7, 2018

I'm sorry I didn't implement the wildcard. You may need to check the skills array in your code. Your question is a good point. I should have done it that way.

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