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

Pick keys of result similarly to $..book[0][category,author] #108

Open
fgodino opened this issue Nov 14, 2019 · 1 comment
Open

Pick keys of result similarly to $..book[0][category,author] #108

fgodino opened this issue Nov 14, 2019 · 1 comment
Labels

Comments

@fgodino
Copy link

fgodino commented Nov 14, 2019

First of all, awesome library this has helped us so much.

I would like to suggest a new feature to return a filtered result selecting the keys. Right now, if we use $..book[0][category,author] it returns a list of results with the values of the object keys in the result. Taking the example $..book[0][category,author], it returns

[ 'reference',
  'Nigel Rees',
  'fiction',
  'Evelyn Waugh',
  'fiction',
  'Herman Melville',
  'fiction',
  'J. R. R. Tolkien' ]

It would be great if we could add a feature to show the actual filtered object bases on these keys. Something like:

[ { category: 'reference', author: 'Nigel Rees' },
  { category: 'fiction', author: 'Evelyn Waugh' },
  { category: 'fiction', author: 'Herman Melville' },
  { category: 'fiction', author: 'J. R. R. Tolkien' } ]

For syntax, it could be like this: $..book[0]{category,author} or this: $..book[0]{category: expr,author:expr}

Let me know what you think.

Thank you!

@brettz9
Copy link
Collaborator

brettz9 commented Nov 15, 2019

While there have been some minor improvements, I haven't had time to develop this library.

I don't know how well it performs, but you might take a look at http://docs.jsonata.org , specifically http://docs.jsonata.org/predicate . By a quick look of things, this looks like a nice, full featured alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants